Topic: Macro names


Author: Jaakko =?iso-8859-1?Q?J=E4rvi?= <jaakko.jarvi@cs.utu.fi>
Date: 1999/05/21
Raw View
Hi,

What are the requirements for valid macro names?

E.g. is this allowed?:

#define $A BuckA

/Jaakko

--
--- Jaakko J   rvi, jaakko.jarvi@cs.utu.fi
--- Turku Centre for Computer Science (www.tucs.fi)
--- Lemmink   isenkatu 14 A, FIN-20520 Turku, Finland
--- Phone: +358-2-333 8656, Fax: +358-2-333 8600


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: James Kuyper <kuyper@wizard.net>
Date: 1999/05/22
Raw View
Jaakko J   rvi wrote:
>
> Hi,
>
> What are the requirements for valid macro names?
>
> E.g. is this allowed?:
>
> #define $A BuckA

No. A '$' is not allowed in an identifier (though many compilers permit
it as an extension). A macro name is an identifier, the rules for
identifier names are:

identifier:
 nondigit
 identifier nondigit
 identifier digit

nondigit: one of
 universal-character-name
 _ a b c d e f g h i j k l m
   n o p q r s t u v w x y z
   A B C D E F G H I J K L M
   N O P Q R S T U V W X Y Z

digit: one of
 0 1 2 3 4 5 6 7 8 9

hexidecimal-digit: one of
 0 1 2 3 4 5 6 7 8 9
 a b c d e f
 A B C D E F

hex-quad:
  hexadecimal-digit hexadecimal-digit hexadecimal-digit
hexadecimal-digit

universal-character-name:
 \u hex-quad
 \U hex-quad hex-quad

Appendix E says what charecters are valid in universal character names
in C++ identifiers.


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]