warning when using __builtin_types_compatible_p

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

 



Hi all,

  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? Thank you
very much.

Regards,
Manish

> foo.c: In function `main':
> foo.c:16: warning: passing arg 1 of `foo_float' from incompatible pointer type


#define foo(x) ({ if (__builtin_types_compatible_p(typeof(x),int*))
foo_int(x); else foo_float(x);})

void foo_int(int* a) {
    printf("a=%d\n", (*a+1));
}

void foo_float(float* a) {
    printf("b=%f\n",(*a+1.0));
}

int main() {
    int a = 10;
    float b = 101;
    foo(&a);
    return 0;
}

[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