4

I was looking at sal.h header in c and found that $ is often used in procedures parameters. What is this? AFAIK, it is not allowed in C.

For example (from MS C/C++ Compiler Include\sal.h)

171  #define _Pre_z_            _Pre2_impl_(_$notnull,  _$zterm) 
Wafeeq
  • 869
  • 1
  • 16
  • 34

1 Answers1

1

The C standard specifies that identifiers may contain letters, digits, and the underscore. That's it. Some compilers (such as GCC) might also allow the use of the dollar sign, but they are doing so outside of the standard, so using this feature will make your program non-portable.

Lee Daniel Crocker
  • 12,927
  • 3
  • 29
  • 55
  • This dollar sign is problem for me. Can you suggest any work around. I am trying to compile c headers with a third party compiler and it does not recognize it. If I only change $ sign with something else, may be? what do you think? – Wafeeq Sep 11 '17 at 17:10
  • 1
    Maybe this code isn't meant to be portable C. Sure, you could change the identifiers and it would probably compile, but there might be other GCC-specific or other non-portable stuff in it. – Lee Daniel Crocker Sep 11 '17 at 18:17