Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Should loop {} really loop indefinitely?

by boftx (Deacon)
on Oct 07, 2013 at 21:40 UTC ( #1057313=note: print w/ replies, xml ) Need Help??


in reply to Should loop {} really loop indefinitely?

The infinite loop is in fact very useful, and I had to explicitly tell my optimizing C compiler (back in the day) not to replace it with a nop instruction when in fact the loop was waiting for an interrupt to occur from an I/O port.

With that perspective, I think the code should in fact just loop there forever. You presumably wrote it that way for a reason. :)

On time, cheap, compliant with final specs. Pick two.


Comment on Re: Should loop {} really loop indefinitely?
Download Code
Re^2: Should loop {} really loop indefinitely?
by grondilu (Pilgrim) on Oct 07, 2013 at 22:23 UTC

    In Perl 6, when you want to idle indefinitely, you should probably write:

    sleep(Inf);

    Also, as mentioned above, replacing loop {} by a nop would be just as false as letting it loop forever. 0 * Inf is neither 0 nor Inf.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-04 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls