Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reserved identifier violation #52

Open
elfring opened this issue Nov 28, 2013 · 4 comments
Open

reserved identifier violation #52

elfring opened this issue Nov 28, 2013 · 4 comments

Comments

@elfring
Copy link

elfring commented Nov 28, 2013

I would like to point out that identifiers like "__zlog_buf_h" and "__zc_defs_h" do not fit to the expected naming convention of the C language standard.
Would you like to adjust your selection for unique names?

@HardySimpson
Copy link
Owner

Counld you tell me, what is the C language standard about this identifiers? Thanks!

@elfring
Copy link
Author

elfring commented Dec 7, 2013

How do you think about to read corresponding information sources that describe the consequences of underscores in such identifiers?

@HardySimpson
Copy link
Owner

Have seen that article. I was surprised by "Names that end with '_t' are reserved"..
Still, names that start with __, which I think, fit the C language standard.

see:
http://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Reserved-Names.html

In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.

__zc_defs_h is not a identifier, it is... I don't know how to call it. But using something like

#ifndef __zlog_mdc_h
#define __zlog_mdc_h
blablalba...
#endif

is quite well. Is my understanding right?

@elfring
Copy link
Author

elfring commented Jan 12, 2014

Include guard macros are also identifiers. If you use double underscores in them like your examples, they become names which are reserved for the use in implementations of C/C++ compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants