[previous] 1013 [next] [S] Use of a C++ reference type ('type &').
Syntax errors

This declaration contains '&' - C++ reference. The programmer probably meant to use '*' instead. This is a common mistake when working in both C and C++ languages.

C++ reference declarations are not valid in ISO:C and message 1013 indicates a syntax error. Syntax errors cannot be suppressed in QAC; however, if the "-ex C++" option is enabled, this code can be parsed as a language extension and message 1012 will be generated instead. Message 1012 can be suppressed if required. Example:


/*PRQA S 553,2211,3199,3203,3205,3227,3408 ++*/

int foo(int *a);


void func1(int &a)                  /* Message 1013 */
{
    int &b = a;                     /* Message 1013 */
    int *c = &a;
    int r;

    r = foo(&a);
}


No MISRA C:2012 Rules applicable to message 1013


See also:

QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents