Re: warning when using __builtin_types_compatible_p

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux