>
>
>
V1059. Macro name overrides a keyword/r…


V1059. Macro name overrides a keyword/reserved name. This may lead to undefined behavior.

The analyzer has detected a macro whose name overrides a keyword or reserved identifier.

Example:

#define sprintf std::printf

Because of the name collision here, calls to the standard function 'sprintf' will be replaced with calls to 'printf' after preprocessing. Such replacement will lead to incorrect work of the program.

This diagnostic also informs the developer when overridden macros get deleted.

Example:

#undef assert

The diagnostic ignores overridden keywords if their semantics is unchanged.

Examples:

#define inline __inline
#define inline __forceinline
#define template extern template

This diagnostic is classified as:

  • CERT-DCL51-CPP