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

An unknown length modifier is being used in conjunction with a '%o' conversion specifier in a scanf format string.

Valid length modifiers for this conversion specifier are "h" and "l" - indicating that the receiving object is of type unsigned short or unsigned long rather than unsigned int.

In the code example below, "L" has been used; but "L" is only valid with %e, %f or %g - to indicate a receiving object of type long double.


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

#include <stdio.h>

extern void foo(void)
{
    unsigned short stot = 0;
    unsigned int   itot = 0;
    unsigned long  ltot = 0;

    scanf("%o",  &itot);               /*                     */
    scanf("%ho", &stot);               /* h indicates "short" */
    scanf("%lo", &ltot);               /* l indicates "long"  */

    scanf("%Lo", &itot);               /* Message 0192 - L is unrecognised */
}


MISRA C:2012 Rules applicable to message 0192:

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