5 ms·
While loops are the exact same thing as GOTOs. It equals to: start: if(!p) goto end ... goto start; end: It should help people figure out
by jules 14y ago
While loops are the exact same thing as GOTOs. It equals to:
start:
if(!p) goto end
...
goto start;
end:
It should help people figure out why it's bad - in 99.99% of the cases ;)
- deleted 14y ago[deleted]
- FredBrach 14y agoA loop is based on a conditional jump (aka. a flow control statement in imperative langs) which makes all the difference. The problem with jumps (is usually called a jump, purely arbitrary jump) is that they are arbitrary: http://news.ycombinator.com/item?id=4627730 http://news.ycombinator.com/item?id=4627730
- Evbn 14y agoHow do know what happens at an end-brace? Have to go look at the matching start-brace to see if it is a while or for or if. Madness! Can I assume the code above even executed once? No! What of I check the guard clause first? It has variables! Oh heavens, control flow depends on arbitrary RUNTIME data!?