This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/35669] NULL (__null) not considered different from 0 with C++



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]