[previous] MISRA C:2012  Rule-4.1:  (Required) [next] Octal and hexadecimal escape sequences shall be terminated

Amplification:

An octal or hexadecimal escape sequence shall be terminated by either:

Example Code:


#include "m3cmex.h"


extern int16_t rule_0401( void )
{
    const char *s1 = "\x41g";                           /*                */ /* Non-compliant */
    const char *s2 = "\x41" "g";                        /*                */ /* Compliant - terminated by end of literal */
    const char *s3 = "\x41\x67";                        /*                */ /* Compliant - terminated by another escape */
    uint16_t c1 = '\141t';                              /*      0284 3628 */ /* Non-compliant */
    uint16_t c2 = '\141\t';                             /*      0284 3628 */ /* Compliant - terminated by another escape */

    return 1;
}


No QAC messages cover this rule.



(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