Hi GCC people, the following code gives me a warning when compiling (on an IA32 host). ---- ~/c/tests 37> cat intptr.cpp #include "stdint.h" #include "stdlib.h"
int main(void) { intptr_t t = 0; if (t != ((intptr_t)NULL)) t = 1; return 0; } lnxsodt25 ~/c/tests 38> g++ --version g++ (GCC) 4.2.1 lnxsodt25 ~/c/tests 39> g++ -c intptr.cpp intptr.cpp: In function 'int main()': intptr.cpp:7: warning: NULL used in arithmetic ---- If I use uintptr_t, gcc gives no warning. After reading cp/typeck.c around build_binary_op and knowing that NULL is in fact null_node with type integer (integer_type_node I think), I guess that the cast is removed in some way so that build_binary_op produces a warning believing I pass NULL as is, without the cast. Of course I could use uintptr_t and everything would be fine, but it's not my own code. Or I might also misunderstand something in there in which case I apologize for this email. Take care, and keep on the good work on this great compiler. Cedric.