View Full Version : dollar sign is legal in gcc

02-03-2002, 09:48 PM

consider this:

#include <iostream.h>

int main()
int $one;

cout << $one;
return 0;

i've tried this code on bcc 5.5 and it does not compile, but on gcc 2.95 (on linux) it compiles perfectly. why?

02-04-2002, 07:05 AM
GG is correct. The '$' character may not be part of an identifier under ANSI C. You can force gcc to adhere strictly to ANSI C by using the -ansi switch in your compiles. What you lose with the -ansi switch are the keywords asm, inline, and typeof (as well as some macros). The gcc man page has all the details.