[previous] MISRA C:2012  Rule-7.1:  (Required) [next] Octal constants shall not be used

Exception:

The integer constant zero (written as a single numeric digit), is strictly speaking an octal constant, but is a permitted exception to this rule.

Example Code:


#pragma PRQA_MESSAGES_OFF 2983,2984

#include "misra.h"
#include "m3cmex.h"

#define MRET 015                     /* 0336 */

extern int16_t rule_0701( void )
{
    int16_t i;
    int16_t j;
    int16_t k;
    PC  pcx;
    PC  buf[] = "ABC\15";            /* 3628 */

    i = 0xFF;
    j = 052;                         /* 0339 */
    k = MRET;
    pcx = '\15';                     /* 3628 */

    return i + j + k;
}


QAC messages that encompass this guideline:

0336 Macro defined as an octal constant.
0339 Octal constant used.
3628 Octal escape sequences used in a character constant or string literal.



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents