Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2004-16.9

In this section:
Synopsis

(Required) A function identifier shall only be used with either a preceding &, or with a parenthesized parameter list, which may be empty.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

One or more function addresses are taken without an explicit &. This check is identical to MISRAC++2008-8-4-4.

Coding standards
MISRA C:2004 16.9

(Required) A function identifier shall only be used with either a preceding &, or with a parenthesized parameter list, which may be empty.

MISRA C++ 2008 8-4-4

(Required) A function identifier shall either be used to call the function or it shall be preceded by &.

Code examples

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

void func(void);

void
example(void)
{
    void (*pf)(void) = func;
}

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

void func(void);

void
example(void)
{
    void (*pf)(void) = &func;
}