VC's "evil" extension: $
In C++, only a few characters can be used as part of the identifier.
identifier:
identifier-nondigit
identifier identifier-nondigit
identifier digit
identifier-nondigit:
nondigit
universal-character-name
other implementation-defined characters
nondigit: one of
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
However, there is one exception in VC. The "evil" extension allows "$" to be valid in identifier name.
It is used inside "sal.h" (Source Annotation Language). Like:
#define _$valid Valid=SA_Yes
But I have no idea why they need "$" :P
Comments
Anonymous
March 03, 2010
Lots of legacy C (and C++) code uses functions that have '$' within the function name. Many of the system calls on OpenVMS have a '$' as part of their name, and it was a common naming convention in a lot of FORTRAN code. As such, support for '$' is a pretty common extension even today. I still have a lot of code that requires such an extension. As to why that particular place uses it, no clue.Anonymous
March 07, 2010
Hi LordHunter317: Thanks for sharing the information. This reminds me the deprecation attempt of trigraph in C++0x (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2910.pdf) Many "obselete" features / language extensions are extensively used :-)