Topic: Defect Report: C++ doesn't allow null void pointer value conversions


Author: Me <anti_spam_email2003@yahoo.com>
Date: Thu, 19 May 2005 15:10:43 +0000 (UTC)
Raw View
[ Note: Forwarded to C++ Committee. -sdc ]

The C standard says: 6.3.2.3/4 Conversion of a null pointer to another
pointer type yields a null pointer of that type. Any two null pointers
shall compare equal.

C++ appears to be incompatible with the first sentence in only two
areas:

A *a = 0;
void *v = a;

C++(4.10/2) says nothing about the value of v

void *v = 0;
A *b = (A*)v; // aka static_cast<A*>(v)

C++(5.2.9/10) says nothing about the value of b.

Proposed changes:
1. Add the following sentence to 4.10/2: "The null pointer value is
converted to the null pointer value of the destination type."
2. Add the following sentence to 5.2.9/10: "The null pointer value
(4.10) is converted to the null pointer value of the destination type."


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]