Declared name uses a form the C standard reserves
ID |
objectivec.maintainability.naming_reserved_identifier |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Naming |
Language |
Objective-C |
Description
Reports a macro, variable or C function defined with a name that starts with an underscore followed by an uppercase letter (_Config), or that contains a double underscore anywhere (counter, statepending). Both forms are reserved for the implementation in every scope. A single leading underscore followed by a lowercase letter (_label) is the Cocoa instance-variable convention and is not reported, and neither are the Clang ownership qualifiers block, weak, strong and autoreleasing, which are uses rather than definitions.
Rationale
The C standard reserves these two spellings for the compiler, the C library and the platform headers, and Objective-C inherits that reservation along with the whole of C. The implementation is free to define a macro or an internal symbol with exactly the same name, so a translation unit that pulls in a system header - directly, or through any of the Foundation umbrella headers - can have its own declaration silently redefined, shadowed, or macro expanded. The resulting failure depends on which headers are included and in what order, so it appears and disappears across SDK versions and platforms rather than failing consistently.
The following code illustrates the pattern detected by this rule:
// FLAGGED: Declared name uses a form the C standard reserves
#define __CACHE_SIZE 10