On Sunday, 15 June 2014 at 07:05:37 UTC, Nick Sabalausky wrote:
True story: I once had to put up with a production codebase (the company's *flagship* product) that wasn't asm (it was VB6) and yet was filled with garbage like this:

if ...cond... then
   ...statements...
   goto somelabel
end
...statements...
somelabel:

Heh, when writing a state machine the implied loops can be nontrivial and then gotos can result in cleaner, tighter and faster code than a regular loop with a switch statement or function pointers or or whatever. Co-routines and gotos can provide pretty clean state machines.

IIRC the minimalistic Beta language used a lower level construct which allowed to loop a block (a pattern/object) using a "restart" statement. Then higher level looping constructs could be built on top of it. Basically like having the "continue" statement refer to a block.

Anyway, "for(;;)" is idiomatic in C by now, so changing it would be a bad idea.

Reply via email to