![]() |
![]() |
0169 | ![]() |
||||
![]() | |||||||
| Explicitly undefined | REFERENCE - ISO:C90-7.9.6.1 Formatted input/output functions | ||||||
An unknown length modifier is being used in conjunction with a '%g' conversion specifier in a printf format string. The only valid length modifier for a '%g' conversion specifier is "L" - indicating that the corresponding argument is of type long double. In the code example below "l" has been used; but "l" is only valid with integer conversion specifiers.
/*PRQA S 185,336,602,1307,2017,3122,3200,3209,3227,3408,3602,3625 ++*/
#include <stdio.h>
extern void foo(float ftot, double dtot, long double ltot)
{
printf("The total is %g", ftot); /* OK */
printf("The total is %g", dtot); /* OK */
printf("The total is %Lg", ltot); /* OK */
printf("The total is %lg", ftot); /* Message 0169 */
}
MISRA C:2012 Rules applicable to message 0169:
| 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 |