[previous] 0171 [next] [U] Unknown length modifier used with 'c' conversion specifier, number %s.
Explicitly undefined REFERENCE - ISO:C90-7.9.6.1 Formatted input/output functions

A length modifier is being used in conjunction with a '%c' conversion specifier in a printf format string.

Length modifiers are used in conjunction with integer and floating conversion specifiers but not with '%c'.

For example:


/*PRQA S 185,336,602,1307,2017,3122,3200,3209,3227,3408,3602,3625 ++*/

#include <stdio.h>

extern void foo(char ch)
{
    printf("The character is %c",  ch);     /*              */

    printf("The character is %hc", ch);     /* Message 0171 */
    printf("The character is %lc", ch);     /* Message 0171 */
}


MISRA C:2012 Rules applicable to message 0171:

Rule-1.3  (Required) There shall be no occurrence of undefined or critical unspecified behaviour


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