Skip to main content

IAR Embedded Workbench for RH850 3.20.x

CERT-MSC40-C_b

In this section:
Synopsis

Do not violate constraints.

Enabled by default

Yes

Severity/Certainty

Low/Low

lowlow.png
Full description

The C Standard, 6.7.4, paragraph 3 outlines the following constraint: An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static or thread storage duration, and shall not contain a reference to an identifier with internal linkage. This check finds cases where a static object is declared in an inline function.

Coding standards
CERT MSC40-C

Do not violate constraints

Code examples

The following code example fails the check and will give a warning:

extern inline void func(void) {
    static int I = 12;
    /* Perform calculations which may modify I */
}

The following code example passes the check and will not give a warning about this issue:

extern inline void func(void) {
    int I = 12;
    /* Perform calculations which may modify I */
}