Re: Linux kernel, possible useless continue
- From: Ulrich Eckhardt <doomster@xxxxxxxx>
- Date: Tue, 20 Mar 2007 21:52:53 +0100
Rainer Weikusat wrote:
Ulrich Eckhardt <doomster@xxxxxxxx> writes:
[...]
for(...)
if(x)
continue;
for(..; .. && !x; ..)
..
The only difference is the initialisation statement in the inner
loop, and for the case we're talking about this small difference
doesn't make a difference overall, in particular not when it is
compiled with a halfway-decent optimiser.
As I understood the original question, it was about code semantics and
not about hypothetical, accidental properties of unknown machine code
generated by a random compiler for an arbitrary architecture.
The compiler that is able to digest Linux is not so random ... ;)
Seriously, fact remains that the initialisation is low-cost in any
environment. Also, it might even be weighed up by the removal of the check
for the continue and less instruction-cache use, but neither is important
enough to merit any obfuscations in code and particularly not without
profiling.
What remains fact is that the if-clause with the continue can be removed
without changing the behaviour of the code, or are you implying that that
is not the case?
And wasn't "established theory" that one should rather not code to
the idiosynkrasies of some translation or execution environment, but
instead try to express the intent of the code clearly and leave 'the
gory details' exactly to the compiler?
I'm not sure what you are implying with this. You are neither confirming
nor denying my initial claim, instead you are attacking me with a
straw-man argument.
If you think I'm talking crap, say so at least and say why!
Uli
.
- Follow-Ups:
- Re: Linux kernel, possible useless continue
- From: Rainer Weikusat
- Re: Linux kernel, possible useless continue
- References:
- Linux kernel, possible useless continue
- From: Bin Chen
- Re: Linux kernel, possible useless continue
- From: Ulrich Eckhardt
- Re: Linux kernel, possible useless continue
- From: Iwo Mergler
- Re: Linux kernel, possible useless continue
- From: Ulrich Eckhardt
- Re: Linux kernel, possible useless continue
- From: Rainer Weikusat
- Linux kernel, possible useless continue
- Prev by Date: Re: Linux kernel, possible useless continue
- Next by Date: Shared Memory...Some Questions.....
- Previous by thread: Re: Linux kernel, possible useless continue
- Next by thread: Re: Linux kernel, possible useless continue
- Index(es):
Relevant Pages
|