[previous] 2118 [next] Default argument promotion : float promoted to double.
Arithmetic type - Integral promotion REFERENCE - ISO:C90-6.3.2.2 Function Calls, 6.5.4.3 Function Declarators, 7.8.1 Variable argument list access macros

An expression of type float is being used as an argument in a function call and is being converted to type double according to the rules of default argument promotion.

Message 2118 will be generated if the function has not been declared or has been declared with an old style declaration. It will not be generated when default argument promotion results from a call to a function declared with a variable argument list.

For example:


/*PRQA S 1302,1303,3200,3209,3227,3408,3447,3602 ++*/

extern void f1(int n, float p);                 /*              - new style function declaration   */
extern void f3();                               /* Message 3001 - old style function declaration   */
extern void f4(int n, ...);                     /*              - new style with variable arg list */

extern void foo(float ft)
{
    f1(1, ft);                                  /*                                      */
    f2(1, ft);                                  /* Message 2118 + 3335 - no declaration */
    f3(1, ft);                                  /* Message 2118                         */
    f4(1, ft);                                  /*                                      */
}


No MISRA C:2012 Rules applicable to message 2118


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