-
Key: CPP12-29
-
Legacy Issue Number: 3534
-
Status: closed
-
Source: Triodia Technologies Pty Ltd ( Michi Henning)
-
Summary:
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
with null.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
-
Disposition Summary:
see below
-
Updated: Fri, 6 Mar 2015 21:38 GMT