Meaning of "__"


In the Linux kernel implementation , I came across this statement on the line 89:

#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })

I know that in C , symbols starting with a _ followed by a capital letter or another _ are reserved for implementation, what does this mean in practice?

asked by anonymous 28.09.2016 / 21:26

2 answers


This means that if you declare a symbol (variable, function, macro, etc.) in this way, you can conflict with symbols exported by the standard compiler or library implementation.

For example, you could try creating a function:

void minha_funcao(int _Param);

But its implementation declares the macro somewhere:

#define _Param 1

In this way, a syntax error will occur because the preprocessor will replace the macro with a value of 1.

28.09.2016 / 21:50

The use of two underscores ('__') in identifiers is reserved for internal compiler use according to the ANSI-C Technical Rule . In practice, this is done to avoid a collision with developer-defined names.


In C, symbols beginning with an underscore followed by a letter   capital or other underlining are reserved for implementation.   You as a C user should not create any symbols that   start with reserved sequences


28.09.2016 / 21:52