C and C++


LANG.STRUCT.DECL.RESERVED : Declaration of Reserved Name

Summary

An identifier in a declaration:

See also: Macro Definition of Reserved Name, Macro Undefinition of Reserved Name.

Properties

Class Name Declaration of Reserved Name
Significance style
Mnemonic LANG.STRUCT.DECL.RESERVED
Categories
MisraC2023 MisraC2023:21.2 A reserved identifier or macro name shall not be declared
Misra2012 Misra2012:21.2 A reserved identifier or macro name shall not be declared
Misra2004 Misra2004:20.2 The names of standard library macros, objects and functions shall not be reused
AUTOSARC++14 AUTOSARC++14:M17-0-2 The names of standard library macros and objects shall not be reused.
  AUTOSARC++14:M17-0-3 The names of standard library functions shall not be overridden.
MisraC++2008 MisraC++2008:17-0-2 The names of standard library macros and objects shall not be reused.
  MisraC++2008:17-0-3 The names of standard library functions shall not be overridden.
CWE CWE:1076 Insufficient Adherence to Expected Conventions
CERT-C CERT-C:DCL37-C Do not declare or define a reserved identifier
CERT-CPP CERT-CPP:DCL51-CPP Do not declare or define a reserved identifier
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Declaration of Reserved Name"

Example

int NULL;                         /* 'Declaration of Reserved Name' warning issued here */

void _fname( void ){              /* 'Declaration of Reserved Name' warning issued here */
    int _y = 0;                   /* 'Declaration of Reserved Name' warning issued here */
    char *printf = "hello world"; /* 'Declaration of Reserved Name' warning issued here */

  /* ... */
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.