------- Additional Comments From matz at suse dot de  2005-01-20 15:35 -------
I agree that C++ is special, and that NULL in C++ is only a null pointer 
constant (but not a null pointer).  Hence, yes, strictly speaking a cast 
would be needed even for NULL in va_lists. 
 
But, as a matter of fact, GCC defines __null as an integer node having value 
zero, and type exactly as wide as a pointer would be (i.e. somewhat 
similar to 0L).  So, giving this to a va_list, which expects a pointer 
would work correctly, also on LP64 platforms.  This is the reason for the 
existance of __null (as otherwise we could simply define NULL to "0" and 
still be completely standard conformant).  This suggests that those 
who implemented __null did it because they wanted to enable its use 
in situations where in C a lonely "NULL" is enough. 
 
As a QOI issue it would be better if this warning wouldn't trigger for this 
use.  In our packages it triggers quite often in C++ code, most of them 
being false positives.  That's in difference to C, where most of these 
warnings indeed are problems for LP64 platforms. 
 
I believe (but haven't verified) that the warning could additionally check 
for the node being == null_node, and not warn in this case.  This wouldn't 
make the warning less usefull AFAICS, and for C++ would reduce the number 
of false positives. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19542

Reply via email to