Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!security!genrad!decvax!duke!phs!smh@mit-eddie.UUCP (Steven M. Haflich) From: smh@mit-eddie.UUCP Newsgroups: net.lang.c Subject: Re: Is this legal C? Message-ID: <951@mit-eddi.UUCP> Date: Wed, 23-Nov-83 07:25:42 EST Article-I.D.: mit-eddi.951 Posted: Wed Nov 23 07:25:42 1983 Date-Received: Sun, 27-Nov-83 03:34:34 EST Lines: 32 References: utcsrgv.2783 <2454@yale-com.UUCP> Relay-Version:version B 2.10.1 6/24/83; site duke.UUCP Posting-Version:version B 2.10.1 6/24/83; site mit-eddie.UUCP Path:duke!decvax!genrad!mit-eddie!smh Message-ID:<951@mit-eddie.UUCP> Date:Wed, 23-Nov-83 07:25:42 EST Organization:MIT, Cambridge, MA A minor quibble with Jerry Leichter, who writes: --------------------------------------------- Consider setjmp/longjmp. The standard way to use them is: if (setjmp(&buf) == 0) { do something } else { handle the low-level error } This has the same control-passing structure as your goto example, once the stack has been unwound. Now, setjmp/longjmp are not part of the language; but they have become pretty universal, and any compiler that made them unimplementable would likely not gain much of a following. --------------------------------------------- To the compiler there is a significant difference between a label on an `if' conditional and the `setjmp' function call. The former requires the compiler generate code (if only an assembler label) while the latter is a function which `magically' bashes -- whoops, I mean restores -- the stack environment identically when `longjmp' is later called. `setjmp' is part of the object library environment, not the language, and it would be incorrect for any C *compiler* to treat it specially. Steve Haflich, MIT Experimental Music Studio