Legacy Issue Number: 3534
Source: Triodia Technologies Pty Ltd ( Michi Henning)
page 1-23 says:
The T* constructor creates a T_var that, when destroyed, will delete
the storage pointed to by the T* parameter. The parameter to this
constructor should never be a null pointer. Compliant implementations
are not required to detect null pointers passed to this constructor.
So, I can't explicitly initialize with null:
T_var tv = 0;
This seems strange, seeing that the default constructor does initialize
Also, the spec doesn't say anything about assignment. Is the following legal?
T_var tv = ...;
tv = 0;
I don't understand the restriction. What's the motivation for
disallowing this? Especially for String_var, the prohibition against null
null seems rather draconian. For example, I may be using a temporary local
String_var for exception safety and then, at some point, decide to
assign null to it to force an early deallocation of the string instead
of having to create a separate scope to achieve this.
At any rate, we should clarify so that, whatever the eventual decision is,
the text for the assignment operator agrees with the text for the constructor.
Reported: CPP 1.1 — Fri, 7 Apr 2000 04:00 GMT
Disposition: Resolved — CPP 1.2
Updated: Fri, 6 Mar 2015 21:38 GMT
CPP12 — Null assignment to String_var?
- Key: CPP12-29
- OMG Task Force: C++ 2002 RTF