Declared name is a keyword in C++ or a later C standard

ID

c.maintainability.naming_keyword_identifier

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Naming

Language

C / C++

Description

Reports a variable, function, or macro declared with a name that is plain in the current C standard but reserved as a keyword in C++: final, override, module, import, and nullptr.

Rationale

These words are ordinary identifiers today, so the declaration compiles, but each one is reserved for a specific purpose in C. Compiling the same translation unit as C, or mixing this header into a C++ project, turns the declaration into a syntax error at the exact line the name is used, with a compiler message that talks about the keyword rather than about the code.

The following code illustrates the pattern detected by this rule:

// FLAGGED: Declared name is a keyword in C++ or a later C standard
int final;

Remediation

Rename the declaration to a word C++ does not reserve. nullptr becomes nullPtr or emptyPtr, module becomes moduleId or unit, import becomes importFile or load, and final/override become isFinal/overridden or a name that describes what the value holds.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved