dollar signs in identifiers (was: warning: '/*' within comment)

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Jun 12 16:08:41 AEST 1990


In article <16490021 at hpcllca.HP.COM> walter at hpcllca.HP.COM (Walter Murray) writes:
-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.)

Quite right; a strictly conforming program cannot use '$' in identifiers.

-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 () { '$'; }

I agree.  Indeed, I stopped using ` characters in comments when I realized
that they could impair portability.

-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.

I agree again.  Further note that multibyte considerations mean that
even the sequence '*' '/' may not be seen in a comment, if through
use of funny characters the parser has entered some shift state.



More information about the Comp.std.c mailing list