-Wbad-function-cast what is a non-matching type
Bill Priest
priestwilliaml@yahoo.com
Thu Feb 27 22:03:00 GMT 2003
gcc 3.2.2 (stock) on Linux ix86
gcc -c -Wbad-function-cast bad_cast_warn.c
bad_cast_warn.c: In function `bad_cast_main':
bad_cast_warn.c:15: warning: cast does not match
function type
unsigned short int bad_cast_warn_func1(void);
long bad_cast_warn_func2(void);
double bad_cast_warn_func3(void);
void bad_cast_main(void)
{
double value1;
double value2;
double value3;
double value4;
double value5;
double value6;
value1 = bad_cast_warn_func1();
value2 = (double) bad_cast_warn_func1();
value3 = bad_cast_warn_func2();
value4 = (short) bad_cast_warn_func2();
value5 = (unsigned long) bad_cast_warn_func2();
value6 = bad_cast_warn_func3();
}
>From the man page
-Wbad-function-cast (C only)
Warn whenever a function call is cast to a
non-matching type. For example, warn if "int
malloc()" is cast
to "anything *".
What is the definition of non-matching??
It would seem to me that value4 above would be a
non-matching type (
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
More information about the Gcc-bugs
mailing list