Re: class object initialisation
White Wolf wrote:[color=blue]
>
>
> I do not care if a later "giving of a correct value" is called assignment
> and not initialization. Just be brave and admit that it is legal to have
> uninitialized PODs around[/color]
In the sense that the word is usually used, yes. But it's very clear
that the standard (and the people who wrote it) consider
"initialization " to be something that occurs when the object is created.
I suppose you can debate whether or not it *always* occurs when an
object is created, but that's not really relevant to how the language is
used. The most important point is that initialization cannot happen at
some later time. Assignment can, and then the object is considered, for
all intents and purposes, initialized, and usable as an rvalue.
The only part of this debate that is important at all is the fact that
initialization and assignment are different, and mutually exclusive.
[color=blue]
> (as long as they are not used as an rvalue) and
> that it is legal to assign a value to an uninitialized POD, which makes it
> initialized. PODs can be initialized "later" than their
> definition/construction.[/color]
But it's not initialization in the sense that the standard uses it. It
is (pseudo-)initialization in the sense that the object is not longer
considered "uninitiali zed" (which actually means "indetermin ate" in the
common use).
[color=blue]
> The initialization (giving a correct initial value
> and thereby forming a valid POD type T) can be done using an assigment.
>[/color]
I don't know why we are still debating this when the standard is so
clear on it. Show me anywhere in the standard where it is even suggested
that assignment can constitute initialization.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
White Wolf wrote:[color=blue]
>
>
> I do not care if a later "giving of a correct value" is called assignment
> and not initialization. Just be brave and admit that it is legal to have
> uninitialized PODs around[/color]
In the sense that the word is usually used, yes. But it's very clear
that the standard (and the people who wrote it) consider
"initialization " to be something that occurs when the object is created.
I suppose you can debate whether or not it *always* occurs when an
object is created, but that's not really relevant to how the language is
used. The most important point is that initialization cannot happen at
some later time. Assignment can, and then the object is considered, for
all intents and purposes, initialized, and usable as an rvalue.
The only part of this debate that is important at all is the fact that
initialization and assignment are different, and mutually exclusive.
[color=blue]
> (as long as they are not used as an rvalue) and
> that it is legal to assign a value to an uninitialized POD, which makes it
> initialized. PODs can be initialized "later" than their
> definition/construction.[/color]
But it's not initialization in the sense that the standard uses it. It
is (pseudo-)initialization in the sense that the object is not longer
considered "uninitiali zed" (which actually means "indetermin ate" in the
common use).
[color=blue]
> The initialization (giving a correct initial value
> and thereby forming a valid POD type T) can be done using an assigment.
>[/color]
I don't know why we are still debating this when the standard is so
clear on it. Show me anywhere in the standard where it is even suggested
that assignment can constitute initialization.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Comment