-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
In C, double underscores should not be used at the start of an identifier #343
Comments
It's definitely "marching to our own drummer", at the least. :-) The use of underscores after the "H5*" prefix for function names in the HDF5 source code follows these rules:
I believe our use of two '_' in package and static scoped function names predates the standard committee taking them away from user code. :-) I blame our non-compliance on the lack of namespace support in C. ;-) I don't have an awesome suggestion to move away from using two '_' in the package and static scopes. I've tossed around various solutions and they mostly look awkward. :-/ |
Thanks for explaining the naming scheme, I understand the point of the change now. More importantly, I confused C and C++, and in fact double underscore is OK within the identifier in C. Here's a link for C, not C++: But I didn't create this ticket for nothing, there are in fact many A great many could be fixed by changing the include guard spelling:
That could like be done with a regex. |
Ah, excellent, glad to know that it's still OK in C. whew ;-) Yes - I noticed the header file inclusion guard issue also and agree with you about fixing those. |
What new spelling? Just drop the leading underscore? |
Yes, that looks fine to me and is what the SEI page offers for a suggested fix. |
OK cool. Seems sometimes 1 leading underscore is used, other times 2. These two regex seem to catch them all:
|
Fixed in #361 |
Please reopen. I just tried building from
I'll make a patch. But this will keep happening unless you add |
Additional fixes here: #1812 |
I notice there were some changes recently like:
cba993c
Where some things got renamed to have double underscores.
However, in C, all names containing a double underscore are reserved:
https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL51-CPP.+Do+not+declare+or+define+a+reserved+identifier
These days clang can warn about that.
So really that change above is kinda backwards. :)
The text was updated successfully, but these errors were encountered: