Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!vax135!cornell!uw-beaver!tektronix!hplabs!intelca!qantel!dual!amd!decwrl!decvax!mcnc!ecsvax!bet From: bet@ecsvax.UUCP Newsgroups: net.lang.c Subject: Re: Using &LABEL Message-ID: <3185@ecsvax.UUCP> Date: Fri, 31-Aug-84 15:00:12 EDT Article-I.D.: ecsvax.3185 Posted: Fri Aug 31 15:00:12 1984 Date-Received: Mon, 3-Sep-84 11:41:27 EDT References: decwrl.3480 Lines: 34 This brings up my only *major* complaint with C -- the weakness of its handling of labels. The question >> Finally, is &LABEL an officially sanctioned K&R construct? I don't >> have my copy with me so I can't look it up right now... is pretty easy (I think): From the C Reference manual, in the back of K&R, section 9.12: ... The only use of a label is as a target of a goto. ... (You can take my word that this isn't an unreasonably out-of-context quote). Many compilers, however, as an accident of implementation, give the address in the code space when you use &label, allow you to assign that to a variable of suitable size (int often works) and branch to it. HOWEVER, this is flagrantly illegal and non-portable. The definition of C prohibits it. So here goes my desired extention to C: Make 'label' be a data type. Consider " :" to be a constant, allow label variables to be created, and in particular arrays of labels. Voila: jump tables! Many (most) uses of goto