This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/35669] NULL (__null) not considered different from 0 with C++
- From: "mdorey at bluearc dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Apr 2009 16:47:19 -0000
- Subject: [Bug c++/35669] NULL (__null) not considered different from 0 with C++
- References: <bug-35669-14453@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from mdorey at bluearc dot com 2009-04-29 16:47 -------
(In reply to comment #10)
> 180) Possible definitions include 0 and 0L, but not (void*)0.
That doesn't forbid defining NULL as nullptr though clearly gcc is within the
current Standard to effectively define it as 0.
> The situation will be different with the upcoming C++1x standard where there
> is null_ptr.
Yes, very different. Per the accepted language defect and paper I cited here
yesterday, in the upcoming standard, the compiler seems required to reject
implicit conversion from NULL to int. This PR then becomes a rejects-valid and
an accepts-invalid bug, rather than an enhancement request for a warning.
void test() {
if (__null); // Explicitly allowed in upcoming Standard (shouldn't warn, PR
24745)
int a = __null; // Disallowed(?) by upcoming Standard (should error, PR 35699
(this PR))
int b = (int)__null; // Explicitly allowed in upcoming Standard (shouldn't
warn, PR 5310)
}
(In reply to comment #11)
> What would be the point of __null otherwise...?
Good question.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35669