Main Content

MISRA C:2023 Rule 1.2

Language extensions should not be used

Since R2024a

Description

Rule Definition

Language extensions should not be used.

Rationale

If a program uses language extensions, its portability is reduced. Even if you document the language extensions, the documentation might not describe the behavior in all circumstances.

Polyspace Implementation

The rule checker flags these language extensions, depending on the version of the C standard used in the analysis. See C standard version (-c-version).

  • C90:

    • long long int type including constants

    • long double type

    • inline keyword

    • _Bool keyword

    • short long int type

    • Hexadecimal floating-point constants

    • Universal character names

    • Designated initializers

    • Local label declarations

    • typeof operator

    • Casts to union

    • Compound literals

    • Statements and declarations in expressions

    • __func__ predefined identifier

    • _Pragma preprocessing operator

    • Macros with variable arguments list

    • asm functions

    • Anonymous unions

    • Empty struct

  • C99:

    • short long int type

    • Local label declarations

    • typeof operator

    • Casts to union

    • Statements and declarations in expressions

    • asm functions

    • Anonymous unions

    • Empty struct

Troubleshooting

If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Standard C Environment
Category: Advisory
AGC Category: Advisory

Version History

Introduced in R2024a

expand all