in reply to Re^2: Memory leak!
in thread Memory leak!

No, while (1) {} gets optimised to for (;;) {} (which I use and pronounced "for ever").

Replies are listed 'Best First'.
Re^4: Memory leak!
by BrowserUk (Patriarch) on Dec 13, 2011 at 02:58 UTC
    No, while (1) {} gets optimised to for (;;) {} (which I use and pronounced "for ever").

    Er, no. for (;;) {} gets deobfuscated to:

    perl -MO=Deparse -e"for(;;){}" while (1) { (); } -e syntax OK

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      I know you know this, but for the benefit of other people reading: You can't always rely on Deparse as the canonical interpretation of the code as run, because it doesn't have all of the information the parser and optree constructor throw away. The best you can do is disable the optimizer and emit the optree (unless, of course, you care about what the optimizer has done).


      Improve your skills with Modern Perl: the free book.

        True. But then all I did was demonstrate that: for(;;) compiled the same as while(1) and the latter is clearer.

        Oh. And then attempted to refute the ridiculous notion that while(1) then "gets optimised to for(;;)".

        But that's just a side show instigated upon one man's misinterpretation of his own mistake, and his subsequent 'definitive' misassertions based upon it.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

      You said "no", but you didn't add anything to support that claim before changing the subject. Please elaborate.
        but you didn't add anything to support that claim

        Oh dear. Come back in the morning when you've calmed down. And if you still cannot see the evidence I posted, go get your eyes tested.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?