Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpcllla!hpcllca!walter From: walter@hpcllca.HP.COM (Walter Murray) Newsgroups: comp.std.c Subject: Re: dollar signs in identifiers (was: warning: '/*' within comment) Message-ID: <16490021@hpcllca.HP.COM> Date: 8 Jun 90 22:29:35 GMT References: <16812@haddock.ima.isc.com> Organization: Hewlett Packard Calif. Language Lab Lines: 37 Karl Heuer writes: > (The Standard requires that the strictly conforming program > #include > #define foo$bar /* define foo to be dollar-bar */ > #ifdef foo > int main(void) { printf("yes\n"); return 0; } > #else > int main(void) { printf("no\n"); return 0; } > #endif > must print "yes"; normal VMS behavior would be to treat `foo$bar' as a single > token and print "no".) I don't see how this can be a strictly conforming program. The source character set is implementation-defined (page 11, lines 3-4), and there is nothing in the standard that requires $ to be a member. (See also page 11, lines 29-32.) In fact, I would have trouble convincing myself that either of the following is a strictly conforming program: /* Program 1 */ int main () { /* $ */ } /* Program 2 */ int main () { '$'; } Any thoughts? Looking at this from a different perspective, must a conforming implementation on an 8-bit-byte machine be prepared to accept all 256 possible bytes in a string literal? Must it map them to 256 distinct values? I think not. The mapping of source file characters to the source character set in translation phase 1 is not defined by the standard. Walter Murray -------------