warning when using __builtin_types_compatible_p
John Love-Jensen
eljay@adobe.com
Mon Jul 28 11:59:00 GMT 2008
Hi Manish,
> I get a warning regarding the incompatible pointer type, when I
> compile a very simple program at the bottom of this email. I must be
> doing something very silly. Does anybody an idea about it?
The foo_float routine takes a float*, but you are passing in an int*, which
is an incompatible type.
Expanding your main, this is what it looks like:
int main()
{
int a = 10;
float b = 101;
{
if(__builtin_types_compatible_p(typeof(&a), int*))
foo_int(&a);
else
foo_float(&a); // <-- warning here
}
return 0;
}
It appears that you want to use some sort of function overloading. I
suggest you use C++ as a "better C" compiler, so you can use the function
overloading feature present in C++, rather than try to mimic that C++
obfuscation feature in C.
HTH,
--Eljay
More information about the Gcc-help
mailing list