C++ definition of NULL
Chad Gatesman
chadg@redrose.net
Tue Mar 2 21:49:00 GMT 1999
Gabriel Dos Reis wrote:
> > I see what you are saying, but unfortunately, this is not my code. I am
> > mearly porting it. And, technically, it should work since the standard says
> > NULL should be a 0 or 0L
> ^^^^^^^^
>
> No. The C++ Standard does not say anything like that. The exact
> wording is:
>
> 18.1/4
> ---
> The macro NULL is an implementation-defined C++ null pointer
> constant in this Internnational Standard (4.10).
> ---
>
> Footnote says:
>
> ---
> Possible definitions include 0 and OL, but not (void*)0.
> ---
>
> Please notice that integer type is not limited to int or long int. It
> includes bool, char, short, ...
>
> But I agree with you that the compiler should have selected
> func(long) is NULL is of integer type.
Yes, possibly selecting it and issuing a warning. If you look at the behavior
with one function, it will select it and issue a warning, but when it has to deal
with overloaded functions it fails completely. Bug?
Chad Gatesman
More information about the Gcc
mailing list