On 7/30/07, Siddhesh Poyarekar wrote:
> On 7/30/07, Dinesh Joshi wrote:
> I'm not considering compiler optimization at all -- let us go with the
> assumption that we have disabled compiler optimization.

Its not even a question about compiler optimizations. Its just how the
compiler will treat the code block and generate object code for it.
The C language doesn't define how that compiler should treat the block
hence you have no control over which piece of code will work better.

> The above example could be implemented as a series of if() else
> if()... but it isn't and I'm trying to find a reason why. Is there a
> case where the while(true) approach actually performs better or equal?

All I can see is that the first example can have only 1 condition
while the other blcok can break over several conditions. Care to
explain in more detail so that your dilemma is more clear in
everyone's mind?

-- 
Regards,
Dinesh A. Joshi

-- 
http://mm.glug-bom.org/mailman/listinfo/linuxers

Reply via email to