Home

Hi,

I believe the x86 type of procesors expect to fall through (thus if compiled
'litterally' the if condition being true).

However if your compiler does or doesn't optimize for that one can only
guess. I would recommend to just try it (and still then it might depend on
the condition).


Regards, Ron AF Greve

http://www.InformationSuperHighway.eu

<aeismail@gmail.com> wrote in message
news:1190219560.652873.190320@k35g2000prh.googlegroups.com...
> Hi, everybody:
>
> A quick question regarding how to write if/then blocks.
>
> Do C++ compilers care in terms of execution (i.e., efficiency) which
> block in an if/then/else loop is executed? That is, will going to the
> "else" block be less efficient than using the "then" block?
>
> My question comes because I want to know if there is any advantage in
> writing the test condition to favor one block over the other. (For the
> code I'm working with, one case is definitely preferred over the
> other--at least 2 to 1.)
>
> Thanks,
>
> --AEI
>

previous
next

Re: bitwise OR AND, etc.
Re: While vs nested if?
What's the difference between the priority queue & set & heap ?
Re: how to join array of integers?
Re: Template compilation error (Nested class pointer specific)
Fundacja Hobbit
Fundacja Sloneczko
Kidprotect
Fundacja Avalon
Podaruj Zycie