What does a double underscore mean in a variable n

2020-02-28 06:47发布

Possible Duplicate:
Why do people use __(double underscore) so much in C++

I was studying the Linux kernel programming code.

There are some data structures and functions which start with a double underscore like:

__u32  len

How is that different from normal variables?

标签: c linux kernel
3条回答
【Aperson】
2楼-- · 2020-02-28 07:17

It means it's a system-reserved name. The C standard says that all names beginning with two underscore, or underscore and capital letter, are reserved for the use of the system or compiler and should not be defined in application code.

查看更多
男人必须洒脱
3楼-- · 2020-02-28 07:18

The other answers are correct that it's reserved for the implementation. Of course here Linux should advance out of the 20th century and use the standard type uint32_t rather than the myriad of nonstandard names (__u32, u_int32_t, ...) that plagued legacy Unices..

查看更多
走好不送
4楼-- · 2020-02-28 07:20

That's a type, defined in here (as well as few other places).

It is by convention that usually a double underscore in front of a type, variable or function name implies a name that is always reserved, as defined in section 7.1.3 of the current standard (C99).

查看更多
登录 后发表回答