[previous] 0195 [next] [U] Unknown length modifier used with 'e/E/f/F/g/G' 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 '%e', '%E', '%f', '%F', '%g' or '%G' conversion specifier in a scanf format string.

Valid length modifiers for these conversion specifiers are "l" and "L" - indicating that the receiving object is of type double or long double.

In the code examples below "h" has been used; but "h" is only valid with integral conversion specifiers.


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

#include <stdio.h>

extern void foo(void)
{
    float        ftot;
    double       dtot;
    long double  ltot;

    scanf("%f",  &ftot);               /*                           */
    scanf("%lf", &dtot);               /* l indicates "double"      */
    scanf("%Lf", &ltot);               /* L indicates "long double" */

    scanf("%hf", &ftot);               /* Message 0195              */
}


MISRA C:2012 Rules applicable to message 0195:

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