Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-17.12

In this section:
Synopsis

(Advisory) A function identifier should only be used with either a preceding &, or with a parenthesized parameter list.

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A function identifier was found that is not preceded by & and has no parenthesized parameter list.

Coding standards
MISRA C:2012 Rule-17.12

(Advisory) A function identifier should only be used with either a preceding &, or with a parenthesized parameter list

Code examples

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

#include <stdint.h>

typedef int32_t (*pfn_i)(void);
extern int32_t func1 ( void ); /* Note: A function */
pfn_i pfn2 = func1; /* Non-compliant */

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

#include <stdint.h>

typedef int32_t (*pfn_i)(void);
extern int32_t func1 ( void ); /* Note: A function */
pfn_i pfn1 = &func1; /* Compliant */