Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!pacbell.com!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!diamond From: diamond@tkou02.enet.dec.com (diamond@tkovoa) Newsgroups: comp.lang.c Subject: Re: Labels as values? Message-ID: <1848@tkou02.enet.dec.com> Date: 17 Jul 90 00:38:04 GMT References: Reply-To: diamond@tkou02.enet.dec.com (diamond@tkovoa) Distribution: comp Organization: Digital Equipment Corporation Japan , Tokyo Lines: 28 In article mikeg@c3.c3.lanl.gov (Michael P. Gerlek) writes: >Simple case: > char *ptr; > label: > ... > ptr = (char *)label; According to the standard, an identifier is a primary (expression) if the identifier designates an object or function. A label does not designate an object or function. However, this is not in a constraints section or syntax, so if a processor provides an extension for this, it is not required to issue a diagnostic (unfortunately). Label space is separate from ordinary identifier space. So if you also have an ordinary identifier (e.g. object, function, or typedef) also named "label", then the processor must use the correct "label" in that expression (i.e. not the label "label"). (Of course, if your ordinary identifier is a typedef name, then the expression will be illegal for other reasons.) The unwanted extension that was granted by several processors is even more dubious, because the value assigned to "ptr" changes when you declare a variable also named "label". When the standard assigns a meaning to a construct, a processor is not allowed to wave some extension and decide that you get a different meaning. -- Norman Diamond, Nihon DEC diamond@tkou02.enet.dec.com This is me speaking. If you want to hear the company speak, you need DECtalk.