Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site unisoft.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!amdcad!lll-crg!lll-lcc!unisoft!fnf From: fnf@unisoft.UUCP (Fred Fish) Newsgroups: net.micro.amiga Subject: Another Lattice C bug (statement-less labels) Message-ID: <25@unisoft.UUCP> Date: Fri, 28-Feb-86 06:40:04 EST Article-I.D.: unisoft.25 Posted: Fri Feb 28 06:40:04 1986 Date-Received: Sat, 1-Mar-86 22:45:10 EST Reply-To: fnf@unisoft.UUCP () Organization: UniSoft Systems; Berkeley, CA Lines: 47 Lattice C is currently the only C compiler that I know of (I tested 3 others) that accepts the following code fragment: main () { goto labl; labl: } All others required that the labl: be attached to a statement, even if only the null statement, as in: main () { goto labl; labl: ; } Note that this second usage is consistent with K&R page 63: "It (a label) can be attached to any *statement* (emphasis mine) in the same function as the goto." And on page 204: "Any statement may be preceded by label prefixes ..." "A null statement is useful to carry a label just before the } of a compound statement ..." Also, from "A C Reference Manual" by Harbison and Steele, page 199: "A label cannot appear by itself but must always be attached to a statement. If it is desired to place a label by itself, for example at the end of a compound statement, it may be attached to a null statement." This construct, a label without a statement, showed up in the amiga3d program recently posted to usenet's net.sources. -Fred =========================================================================== Fred Fish UniSoft Systems Inc, 739 Allston Way, Berkeley, CA 94710 USA {ucbvax,dual}!unisoft!fnf (415) 644 1230 TWX 11 910 366-2145 ===========================================================================