[previous] 0194 [next] [U] Unknown length modifier used with 'x/X' 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 '%x' or '%X' 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("%x",  &itot);               /*                     */
    scanf("%hx", &stot);               /* h indicates "short" */
    scanf("%lx", &ltot);               /* l indicates "long"  */

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

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents