Date: Fri, 26 Jul 2013 22:05:08 -0500
Jeffrey Yasskin <jyasskin_at_[hidden]> writes:
[...]
| > I am unconvinced we need to embark on a complete overhaul of the basic
| > C++'s object model, where the outcome would be that one would talk of an
| > object's value before it is ever constructed.
|
| FWIW, there's some precedent for talking about an object's value
| before it's constructed: [basic.start.init] says that static objects
| are "zero-initialized before before any other initialization takes
| place." The same sort of statement might work for discussing the
| object representation of an object at the start of its constructor.
I don't think that is a precedent. Look very carefully at the wording,
and how each "kind" of object and corresponding zero-initialization is
described.
Also, look at 3.8/1. Furthermore, 3.8/3 is pretty clear:
The properties ascribed to objects throughout this International
Standard apply for a given object only during its lifetime. [Note: In
particular, before the lifetime of an object starts and after its
lifetime ends there are significant restrictions on the use of the
object, as described below, in 12.6.2 and in 12.7. Also, the behavior
of an object under construction and destruction might not be the same
as the behavior of an object whose lifetime has started and not
ended. 12.6.2 and 12.7 describe the behavior of objects during the
construction and destruction phases. — end note ]
the rest of section 3.8 pretty much restrict what you can do with an
object's storage before its lifetime starts.
-- Gaby
[...]
| > I am unconvinced we need to embark on a complete overhaul of the basic
| > C++'s object model, where the outcome would be that one would talk of an
| > object's value before it is ever constructed.
|
| FWIW, there's some precedent for talking about an object's value
| before it's constructed: [basic.start.init] says that static objects
| are "zero-initialized before before any other initialization takes
| place." The same sort of statement might work for discussing the
| object representation of an object at the start of its constructor.
I don't think that is a precedent. Look very carefully at the wording,
and how each "kind" of object and corresponding zero-initialization is
described.
Also, look at 3.8/1. Furthermore, 3.8/3 is pretty clear:
The properties ascribed to objects throughout this International
Standard apply for a given object only during its lifetime. [Note: In
particular, before the lifetime of an object starts and after its
lifetime ends there are significant restrictions on the use of the
object, as described below, in 12.6.2 and in 12.7. Also, the behavior
of an object under construction and destruction might not be the same
as the behavior of an object whose lifetime has started and not
ended. 12.6.2 and 12.7 describe the behavior of objects during the
construction and destruction phases. — end note ]
the rest of section 3.8 pretty much restrict what you can do with an
object's storage before its lifetime starts.
-- Gaby
Received on 2013-07-27 05:05:24