Why is gcc not showing a warning message for using $ in a variable name?

You get a warning with -std=c89 -pedantic. C99 and later allow other implementation-defined characters in identifiers.


According to this : GCC Documentation

In GNU C, you may normally use dollar signs in identifier names. This is because many traditional C implementations allow such identifiers. However, dollar signs in identifiers are not supported on a few target machines, typically because the target assembler does not allow them.

So, $ is valid, but it's not a conforming way to code in C.

Tags:

C

Gcc

Gcc Warning