Re: what does two semicolns ';;' do



Iv??n S??nchez Ortega <ivansanchez-alg@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Thomas Mlynarczyk wrote:

jimp@xxxxxxxxxxxxxxxxxxxx schrieb:

AIR for(;;) is slightly more efficient/faster than while(1).

How come? Isn't [for] just syntactic sugar for [while] and should
therefore internally be the same?

It really depends on how your compiler optimizes jumps and boolean
expressions. A good compiler will know that both while(1) and for(;;) are
infinite loops and will translate them to non-conditional jumps in
assembler, effectively rendering them the same.

A bad compiler won't.

And some compilers will recognize one but not the other.


--
Jim Pennino

Remove .spam.sux to reply.
.



Relevant Pages

  • Re: cobfd
    ... >>hi why can an old, free program like this spit translate the file defs, ... > The Demo I posted here doesn't just translate the file defs, ... you don't need a compiler, ... > copybooks to NovaXchange script notation. ...
    (comp.lang.cobol)
  • Re: Origin of size_t? Curious.
    ... > "be able to successfully translate and execute", ... >>> says what the compiler has to do. ... that doesn't stop it being a strictly conforming program. ...
    (comp.lang.c)
  • Re: [OT] Re: size of a sizeof(pointer)
    ... compilers are software systems that translate programs ... >> or machine language for execution on a computer. ... no one would call this translator a compiler. ...
    (comp.lang.c)
  • Re: how come OS be written in C
    ... and translate assembler and translate that assember to hex and stor ... translate a basic C language to assembler. ... Then you will use that simple compiler to ... tools to get an operating system up and running. ...
    (comp.lang.c)
  • Re: what does two semicolns ;; do
    ... loops like: ... AIR foris slightly more efficient/faster than while. ... Both statements translate to exactly one assembly ... Since we're presuming we don't know how clever the compiler is ...
    (comp.lang.php)