Opened 16 years ago
Last modified 14 years ago
#689 new Defect
reserved identifier violation
Reported by: | elfring | Owned by: | |
---|---|---|---|
Priority: | Minor | Milestone: | Undetermined |
Component: | Undetermined | Version: | 6.3.4 |
Keywords: | reserved identifiers, naming convention | Cc: |
Description
I suggest to try the search pattern "\b_+[A-Z]+" on the source files. You will find a couple of places where names are used that begin with an underscore and an uppercase letter.
Examples:
This does not fit to the expected naming conventions of the C language standard.
Change History (6)
comment:1 Changed 16 years ago by
Keywords: | naming convention coding style removed |
---|
comment:2 Changed 16 years ago by
Milestone: | 6.4 → Undetermined |
---|
comment:3 Changed 16 years ago by
Component: | BOINC - API → Undetermined |
---|---|
Owner: | Bruce Allen deleted |
comment:4 follow-up: 5 Changed 14 years ago by
C++, sec 17.4.3.1.3: Each name having two consecutive underscores (2.11) is reserved to the implementation for use as a name with both extern "C" and extern "C++" linkage.
So various names like
__cuInit
defined-and-used in client/coproc_detect.cpp are not
standard-conforming.
AFAICT the identifiers used in coproc_detect.cpp are
chosen by boinc, not cuda (my apologies for this note if those
specific identifiers with leading underbars are somehow required by the cuda library,
as in that case all is well).
Those seem to the only double-underscore names defined in boinc.
comment:5 Changed 14 years ago by
Keywords: | reserved identifiers naming convention added |
---|
Replying to dandelot:
How do you think about a corresponding clean-up for your include guards?
comment:6 Changed 14 years ago by
The include-guards rules (using guards that follow the C/C++ rules) suggested in the link make sense to me.
It's difficult to ensure that include-guards in boinc work without conflicting with other non-boinc identifiers, but adding to the referenced suggestions by preceeding (in boinc source) the guards with BOINC_ would be effective for most (assuming headers guards always had a trailing _H to avoid confusing them with capitalized class names like BOINC_PROCESS).
For example, in ViewNotices.h
ViewNotices.h:#ifndef _VIEWNOTIFICATIONS_H_
could be #ifndef BOINC_VIEWNOTIFICATIONS_H_
(of course change all instances of _VIEWNOTIFICATIONS_H_
so it all works.)
Having the header file named ViewNotices.h
while the guard is renamed
BOINC_VIEWNOTIFICATIONS_H_
(inconsistent spelling, notices vs notifications)
is slightly jarring but otherwise harmless.
I hope these comments are responsive to elfring's question...
This report is about many different parts of the code, not API only.