[previous] 4021 [next] long double value returned from char %s().
Arithmetic type - Implicit conversions

An expression of type long double is the return expression in a function that returns a value of type plain char. Any implicit conversion from a long doubleing type to an integral type may result in a loss of precision as the fractional element of the value is discarded. If the integral element of the value cannot be represented, the result will be meaningless.

However converting a long doubleing type to a plain char type is even more suspect. Is this really intended ? Type char should be reserved for character data.

For example:


/*PRQA S 2017,3408,3447,3602,3625 ++*/

extern long double v;

extern char foo ( void )
{
    /* ... */
    return(v);                          /* Message 4021 */
}

See also:

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