why does Erlang define macros reserved for the C compiler?

Matthias Lang <>
Thu May 18 12:07:34 CEST 2006

Attempting to answer my own question.

A clue from Bengt and some googling gave me an answer for most of the
defines. At least some of them are GCC voodoo:


Grepping for the __deprecated that started me wondering reveals that
it's only used in erts/emulator/beam/erl_alloc.h, to mark deprecated

Conclusion: the warning can be ignored. It could be eliminated by
testing for an existing definition before redefining it.

I still don't know why the __SYS_H__ is there. For header files in the
C library, it makes perfect sense to be using names with leading
underscores---they're reserved, so you can be sure you don't screw up
the user's namespace. Using it in Erlang, on the other hand, makes
no sense. It's probably just historical cruft.



Matthias Lang writes:
 > I'm looking at erts/emulator/beam/sys.h.
 > When building Erlang, the compiler prints out a bunch of warnings
 > about __deprecated being redefined. This seems to be C99 7.1.3 in
 > action, i.e. identifiers starting with _ are reserved for the C
 > compiler and C library.
 > The defines in that file with leading underscores:
 >   __SYS_H__
 >   _DOTS_
 >   _VOID_
 >   __noreturn
 >   __deprecated
 > Some of these, e.g. __deprecated, look like some sort of GCC
 > voodoo. Does anybody know more?
 > Matthias

More information about the erlang-questions mailing list