On Mon, 2007-07-30 at 14:24 +0530, Siddhesh Poyarekar wrote:
It is, and the way it has actually been used makes it look even more suspicious:
while(true) { if(condition1) { do_something; break; } if(condition2) { do_something; break; }
do_something;
break; }
Besides being unreadable, does this code have any performance drawbacks as well? My guess is that it would always ruin instruction pipelining since the loop code will be pre-fetched/cached. But that's just a hunch.
Umm...the question you asked is very implementation specific. It not only depends on how the compiler optimizes the code but also on the executable code it produces and how exactly the processor executes it.
So unless you want to restrict your code to particular compiler and a particular processor you shouldn't be really worrying about these issues.
I think I'll have to search for my Computer Architecture book now ;)
No point unless you are targeting a particular processor and a compiler.