The Usage of Double Underscores in C
When browsing through open-source C code, the frequent use of double underscores, particularly at the beginning of variable names, may be observed. Is this a common coding style or does it serve a specific purpose?
According to the "Programming in C , Rules and Recommendations" guide, the double underscore (__) in identifiers is strictly reserved for the compiler's internal use, as per ANSI-C standards. To avoid potential conflicts with these internal identifiers, it is advised against starting an identifier with an underscore.
Additionally, library functions often employ underscores in their names (e.g., "_main" and "_exit"). Therefore, to minimize clashes, it is recommended to refrain from commencing an identifier with an underscore.
The above is the detailed content of What\'s the Purpose of Double Underscores in C Variable Names?. For more information, please follow other related articles on the PHP Chinese website!