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

An unknown length modifier is being used in conjunction with a '%i' or '%d' conversion specifier in a printf format string.

Valid length modifiers for these conversion specifiers are "h" and "l" - indicating that the corresponding argument is of type short or long.

In the code example below "L" has been used; but "L" is only valid with %e, %f or %g.


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

#include <stdio.h>

extern void foo(int itot, short stot, long ltot)
{
    printf("The total is %d",  itot);   /* OK */
    printf("The total is %hd", stot);   /* OK */
    printf("The total is %ld", ltot);   /* OK */

    printf("The total is %Ld", itot);   /* Message 0161 */
}

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