4 ms·
Look at the comments. The same Paul heckbert from 1988 showed up.
by kken 13y ago
Look at the comments. The same Paul heckbert from 1988 showed up.
- edw519 13y ago"And yeah, I remember that fill code. I always felt guilty because it contained a goto statement. I don't think I've written a "goto" since." Loved this! Glad I'm not the only one :-) My last goto statement was in 1984, rejected by Code Review. I haven't written a goto since. And I haven't cared much for Code Review since, either.
- barrkel 13y agoGotos aren't that infrequent in C and C++ written without exceptions or longjmps, and stack-based cleanup needs to occur. Last time I wrote a goto in a language that did have exceptions was the alignment portion of an unrolled loop implementation of a hash algorithm. Delphi doesn't support C-style switch statements where one case flows into the next; so the alignment switch did jumps into the unrolled loop body.
- mratzloff 13y agoYep. Gotos can be the cleanest way of handling certain errors in C.
- kroger 13y ago"By the way, if you don’t like goto statements, don’t read this. (And don’t read any other programs that simulate multistate systems.)" Knuth, on the Adventure game [1] Knuth's "Structured programming with go to statements" [2] is always a good read. [1] http://www.literateprogramming.com/adventure.pdf http://www.literateprogramming.com/adventure.pdf [2] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.6084 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.... EDIT: formatting
- cremno 13y ago>The idea for pre-increment (++x) and post-increment (x++) operators in C came from PDP-11 assembler language. He's wrong. >Thompson went a step further by inventing the ++ and -- operators, which increment or decrement; their prefix or postfix position determines whether the alteration occurs before or after noting the value of the operand. They were not in the earliest versions of B, but appeared along the way. People often guess that they were created to use the auto-increment and auto-decrement address modes provided by the DEC PDP-11 on which C and Unix first became popular. This is historically impossible, since there was no PDP-11 when B was developed. The PDP-7, however, did have a few `auto-increment' memory cells, with the property that an indirect memory reference through them incremented the cell. This feature probably suggested such operators to Thompson; the generalization to make them both prefix and postfix was his own. Indeed, the auto-increment cells were not used directly in implementation of the operators, and a stronger motivation for the innovation was probably his observation that the translation of ++x was smaller than that of x=x+1. Source: http://cm.bell-labs.com/cm/cs/who/dmr/chist.html http://cm.bell-labs.com/cm/cs/who/dmr/chist.html