 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Matthias Hofmann Guest
|
Posted: Tue Aug 29, 2006 8:40 pm Post subject: Defect Report: Copy-initialization in brace-enclosed initial |
|
|
Section 8.5/12 says: "The initialization that occurs in [...] and
brace-enclosed initializer lists is called copy-initialization, and is
equivalent to the form T x = a;", which seems to require an accessible copy
constructor in the expression
T arr[N] = {};
However, section 8.5.1/7 says: "If there are fewer initializers in the list
than there are members in the aggregate, then each member not explicitly
initialized shall be default-initialized (8.5)."
Now the problem is that the standard requires copy-initialization, while not
providing for an object to be copied. Perhaps the intent is that only
explicit initializers in the list are copy-initialization, but the standard
is not clear here.
The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in turn default
initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is default
initialized is 'arr[0]' rather than a temporary.
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Toilet Tycoon
http://www.anvil-soft.de - Die Macher des Klomanagers
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Aug 29, 2006 8:40 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
"Matthias Hofmann" wrote:
| Quote: | Section 8.5/12 says: "The initialization that occurs in [...] and
brace-enclosed initializer lists is called copy-initialization, and is
equivalent to the form T x = a;", which seems to require an accessible copy
constructor in the expression
T arr[N] = {};
However, section 8.5.1/7 says: "If there are fewer initializers in the list
than there are members in the aggregate, then each member not explicitly
initialized shall be default-initialized (8.5)."
Now the problem is that the standard requires copy-initialization, while not
providing for an object to be copied. Perhaps the intent is that only
explicit initializers in the list are copy-initialization, but the standard
is not clear here.
The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in turn default
initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is default
initialized is 'arr[0]' rather than a temporary.
|
A third option is possible: copy initialization from a
default-initialized temporary is technically required, and the
existence of an accessible copy constructor is therefore required, but
the copy can be elided as an optimization. I'm not saying that the
current standard clearly requires (or prohibits) this; just that it's a
possible resolution to the DR.
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Alberto Ganesh Barbati Guest
|
Posted: Wed Aug 30, 2006 12:31 am Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Matthias Hofmann ha scritto:
| Quote: | Section 8.5/12 says: "The initialization that occurs in [...] and
brace-enclosed initializer lists is called copy-initialization, and is
equivalent to the form T x = a;", which seems to require an accessible copy
constructor in the expression
T arr[N] = {};
|
If you read carefully 8.5, you will see that the, despite the name,
copy-initialization does not necessarily require a copy constructor.
That is true for both arrays and non-arrays. This is a common
misunderstanding. There was recently a thread about this on
comp.lang.c++.moderate.
| Quote: | However, section 8.5.1/7 says: "If there are fewer initializers in the list
than there are members in the aggregate, then each member not explicitly
initialized shall be default-initialized (8.5)."
|
You are referring to an old version of the standard. The 2003 version
reads differently: "If there are fewer initializers in the list than
there are members in the aggregate, then each member not explicitly
initialized shall be value-initialized (8.5)." Notice the
"value-initialized" instead of the "default-initialized". Naively
speaking, value-initialization is either default-initialization or
zero-initialization according to the type of the object and/or the
presence of user defined constructors.
BTW: Always refer to the most recent version of the standard when
submitting defect reports!
| Quote: | Now the problem is that the standard requires copy-initialization, while not
providing for an object to be copied. Perhaps the intent is that only
explicit initializers in the list are copy-initialization, but the standard
is not clear here.
|
I agree that the name copy-initialization is confusing and the whole
initialization process is in some cases complex and possibly
unintuitive, but apart from that, the standard is very clear, IMHO.
| Quote: | The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in turn default
initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is default
initialized is 'arr[0]' rather than a temporary.
|
As we saw above, the array member is going to be value-initialized. Such
process, clearly described in the standard, is performed directly on the
target object and does not require the creation/copy of a temporary.
HTH,
Ganesh
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Jens Theisen Guest
|
Posted: Wed Aug 30, 2006 3:07 am Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Alberto Ganesh Barbati wrote:
| Quote: | If you read carefully 8.5, you will see that the, despite the name,
copy-initialization does not necessarily require a copy constructor.
|
I just read it and it seems that
X x = X();
doesn't despite the common belief that it does. Am I reading this correctly?
| Quote: | You are referring to an old version of the standard. The 2003 version
reads differently
|
Interesting. Is this the draft of the new C++0x, or indeed an update of
C++98? I would have thought that this is clearly distinguished and DRs
for C++98 still refer to the old standard.
| Quote: | I agree that the name copy-initialization is confusing and the whole
initialization process is in some cases complex and possibly
unintuitive, but apart from that, the standard is very clear, IMHO.
|
The old standard was contradicting itself, IMHO, but can only be
interpreted in one sensible way as I see it (that being the latter
correction of Matthias' DR).
| Quote: | As we saw above, the array member is going to be value-initialized.
|
My standard doesn't contain that term, I guess it's a C++0x thing?
Jens
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Greg Herlihy Guest
|
Posted: Wed Aug 30, 2006 8:05 am Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
"Matthias Hofmann" wrote:
| Quote: | Section 8.5/12 says: "The initialization that occurs in [...] and
brace-enclosed initializer lists is called copy-initialization, and is
equivalent to the form T x = a;", which seems to require an accessible copy
constructor in the expression
T arr[N] = {};
However, section 8.5.1/7 says: "If there are fewer initializers in the list
than there are members in the aggregate, then each member not explicitly
initialized shall be default-initialized (8.5)."
Now the problem is that the standard requires copy-initialization, while not
providing for an object to be copied. Perhaps the intent is that only
explicit initializers in the list are copy-initialization, but the standard
is not clear here.
The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in turn default
initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is default
initialized is 'arr[0]' rather than a temporary.
|
§8.5/15 clause 6 provides the final, missing step needed to complete
the above analysis.
To recap the line of reasoning so far:
T array[0] = {};
is equivalent to:
T array[0] = { T() };
which in turn can be interpreted as:
T array[0] = T();
which in turn becomes:
T t = T();
At this point, §8.5/15 provides a dramatic, surprising and satisfying
dénouement: it turns out that a copy initialization in which the class
of the source object is identical to - or derived from - the class of
the destination object is - in fact - a direct initialization (for all
practical purposes):
T t(T());
There we have it. To answer the question: there is no copy constructor
needed for T because no copy initialization actually takes place. As a
further consequence, there is no defect in the Standard regarding this
question, since a (very) close reading of a very recent draft of the
Standard does provide the answer.
Greg
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
kanze Guest
|
Posted: Wed Aug 30, 2006 5:29 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Greg Herlihy wrote:
| Quote: | "Matthias Hofmann" wrote:
Section 8.5/12 says: "The initialization that occurs in
[...] and brace-enclosed initializer lists is called
copy-initialization, and is equivalent to the form T x =
a;", which seems to require an accessible copy constructor
in the expression
T arr[N] = {};
However, section 8.5.1/7 says: "If there are fewer
initializers in the list than there are members in the
aggregate, then each member not explicitly initialized shall
be default-initialized (8.5)."
Now the problem is that the standard requires
copy-initialization, while not providing for an object to be
copied. Perhaps the intent is that only explicit
initializers in the list are copy-initialization, but the
standard is not clear here.
The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in
turn default initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is
default initialized is 'arr[0]' rather than a temporary.
§8.5/15 clause 6 provides the final, missing step needed to
complete the above analysis.
To recap the line of reasoning so far:
|
One of the lines of reasoning. The one that puts the statement
in §8.5/12 ahead of the one in 8.5.1/7.
| Quote: | T array[0] = {};
is equivalent to:
T array[0] = { T() };
which in turn can be interpreted as:
T array[0] = T();
which in turn becomes:
T t = T();
At this point, §8.5/15 provides a dramatic, surprising and
satisfying dénouement: it turns out that a copy initialization
in which the class of the source object is identical to - or
derived from - the class of the destination object is - in
fact - a direct initialization (for all practical purposes):
T t(T());
|
I'm aware of that, but what does it change?
| Quote: | There we have it. To answer the question: there is no copy
constructor needed for T because no copy initialization
actually takes place.
|
And what constructor do you use when you initialize an object of
type T with an expression of type T?
| Quote: | As a further consequence, there is no defect in the Standard
regarding this question, since a (very) close reading of a
very recent draft of the Standard does provide the answer.
|
I'm not sure. I don't see where the replacement of
default-initialized with value-initialized changes anything.
The problem is that neither default-initialization nore
value-initialization are copy-initializations, so in one place,
the standard still says that copy-initialization will be used,
and in another, that value-initialization will be used. And it
cannot be both.
--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Francis Glassborow Guest
|
Posted: Wed Aug 30, 2006 8:06 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
In article <44f4b491$0$18484$9b4e6d93 (AT) newsspool3 (DOT) arcor-online.net>, Jens
Theisen <jth02 (AT) arcor (DOT) de> writes
| Quote: | As we saw above, the array member is going to be value-initialized.
My standard doesn't contain that term, I guess it's a C++0x thing?
The 2003 amended version does. See 8.5 para 5 |
--
Francis Glassborow ACCU
Author of 'You Can Do It!' and "You Can Program in C++"
see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Matthias Hofmann Guest
|
Posted: Wed Aug 30, 2006 8:08 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
"Greg Herlihy" <greghe (AT) pacbell (DOT) net> schrieb im Newsbeitrag
news:1156920408.341392.291790 (AT) h48g2000cwc (DOT) googlegroups.com...
| Quote: | §8.5/15 clause 6 provides the final, missing step needed to complete
the above analysis.
To recap the line of reasoning so far:
T array[0] = {};
is equivalent to:
T array[0] = { T() };
|
Well, this is the question.
| Quote: | which in turn can be interpreted as:
T array[0] = T();
which in turn becomes:
T t = T();
At this point, §8.5/15 provides a dramatic, surprising and satisfying
dénouement: it turns out that a copy initialization in which the class
of the source object is identical to - or derived from - the class of
the destination object is - in fact - a direct initialization (for all
practical purposes):
T t(T());
|
I do not have the C++03 draft of the standard available so I don't know
whether there have been changes to the meaning of direct initialization. But
am I wrong in thinking that direct initialization requires a copy
constructor even more than copy initialization? At least if the source and
the target types are identical?
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Toilet Tycoon
http://www.anvil-soft.de - Die Macher des Klomanagers
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
James Dennett Guest
|
Posted: Wed Aug 30, 2006 9:12 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Jens Theisen wrote:
| Quote: | Alberto Ganesh Barbati wrote:
|
[snip]
| Quote: | You are referring to an old version of the standard. The 2003 version
reads differently
Interesting. Is this the draft of the new C++0x, or indeed an update of
C++98? I would have thought that this is clearly distinguished and DRs
for C++98 still refer to the old standard.
|
The current C++ standard is ISO/IEC 14882:2003, aka C++03.
C++03 is C++98 combined with TC1, which was not published
separately so far as I know.
(The current draft standard is, as one would expect, from
2006.)
| Quote: | I agree that the name copy-initialization is confusing and the whole
initialization process is in some cases complex and possibly
unintuitive, but apart from that, the standard is very clear, IMHO.
The old standard was contradicting itself, IMHO, but can only be
interpreted in one sensible way as I see it (that being the latter
correction of Matthias' DR).
As we saw above, the array member is going to be value-initialized.
My standard doesn't contain that term, I guess it's a C++0x thing?
|
A C++03 thing, if memory serves. C++98 was somewhat defective
in this area; with various corrections folded in it's better,
though naturally still not perfect.
-- James
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Matthias Hofmann Guest
|
Posted: Wed Aug 30, 2006 9:27 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
"Alberto Ganesh Barbati" <AlbertoBarbati (AT) libero (DOT) it> schrieb im Newsbeitrag
news:2F%Ig.86371$zy5.1470746 (AT) twister1 (DOT) libero.it...
| Quote: | Matthias Hofmann ha scritto:
Section 8.5/12 says: "The initialization that occurs in [...] and
brace-enclosed initializer lists is called copy-initialization, and is
equivalent to the form T x = a;", which seems to require an accessible
copy
constructor in the expression
T arr[N] = {};
If you read carefully 8.5, you will see that the, despite the name,
copy-initialization does not necessarily require a copy constructor.
That is true for both arrays and non-arrays. This is a common
misunderstanding. There was recently a thread about this on
comp.lang.c++.moderate.
|
I remember such a thread, I don't know whether it is the same as the one you
are having in mind. That discussion was about template constructors, and
there I have learned that a template constructor can do the job of a copy
constructor in the case of copy initialization. It was also concluded that
(if the source and target types are not identical) copy initialization is
actually a conversion followed by direct initialization.
Given that, the expression
T arr[N] = {};
should require an accessible constructor that takes a T as its argument.
This can be a copy constructor or a template constructor.
| Quote: | However, section 8.5.1/7 says: "If there are fewer initializers in the
list
than there are members in the aggregate, then each member not explicitly
initialized shall be default-initialized (8.5)."
You are referring to an old version of the standard. The 2003 version
reads differently: "If there are fewer initializers in the list than
there are members in the aggregate, then each member not explicitly
initialized shall be value-initialized (8.5)." Notice the
"value-initialized" instead of the "default-initialized". Naively
speaking, value-initialization is either default-initialization or
zero-initialization according to the type of the object and/or the
presence of user defined constructors.
|
If I understand this correctly, value-initialization does not involve a copy
constructor. This would make things clear.
| Quote: | BTW: Always refer to the most recent version of the standard when
submitting defect reports!
|
Where can I get a copy of the latest draft?
| Quote: | Now the problem is that the standard requires copy-initialization, while
not
providing for an object to be copied. Perhaps the intent is that only
explicit initializers in the list are copy-initialization, but the
standard
is not clear here.
I agree that the name copy-initialization is confusing and the whole
initialization process is in some cases complex and possibly
unintuitive, but apart from that, the standard is very clear, IMHO.
|
I agree that the C++03 draft seems to be rather clear on that issue.
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Toilet Tycoon
http://www.anvil-soft.de - Die Macher des Klomanagers
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Alberto Ganesh Barbati Guest
|
Posted: Wed Aug 30, 2006 9:28 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Greg Herlihy ha scritto:
| Quote: | "Matthias Hofmann" wrote:
The question is whether in
T arr[1] = {};
the object is copy initialized with a temporary that is in turn default
initialized, such as in
T arr[1] = { T() };
or whether no temporary is created, and the object that is default
initialized is 'arr[0]' rather than a temporary.
§8.5/15 clause 6 provides the final, missing step needed to complete
the above analysis.
|
§8.5/15 clause 6 does not apply, because clause 3 "Otherwise, if the
destination type is an array, see 8.5.1." is in effect. The rest of the
reasoning is therefore incorrect as it starts with a wrong assumption.
Ganesh
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Francis Glassborow Guest
|
Posted: Wed Aug 30, 2006 11:18 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
In article <4ll3adF2b73pU1 (AT) individual (DOT) net>, Matthias Hofmann
<hofmann@anvil-soft.com> writes
| Quote: | I do not have the C++03 draft of the standard available
|
It is not a draft, it is the current C++ Standard.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' and "You Can Program in C++"
see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Alberto Ganesh Barbati Guest
|
Posted: Thu Aug 31, 2006 6:55 am Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Matthias Hofmann ha scritto:
| Quote: | "Alberto Ganesh Barbati" <AlbertoBarbati (AT) libero (DOT) it> schrieb im Newsbeitrag
news:2F%Ig.86371$zy5.1470746 (AT) twister1 (DOT) libero.it...
Matthias Hofmann ha scritto:
Given that, the expression
T arr[N] = {};
should require an accessible constructor that takes a T as its argument.
This can be a copy constructor or a template constructor.
|
Incorrect. As I already wrote in another post, every element of the
array is simply value-initialized. That is:
1) if T is a built-in type or if T is a class without any user-defined
constructors, then every element is zero-initialized (well... I
oversimplified a bit for classes, just to give you the idea. Actually,
in this case, value-initialization is recursively applied to every
non-static data member and base class, see 8.5/5 for details)
2) if T is a class with an accessible default constructor, then every
element is default-initialized
3) if T is a class with user-defined constructors but without or with an
inaccessible default constructor, then the code is ill-formed.
In *no* cases the copy constructor is either required or used.
| Quote: | If I understand this correctly, value-initialization does not involve a copy
constructor. This would make things clear.
|
Exactly.
| Quote: | BTW: Always refer to the most recent version of the standard when
submitting defect reports!
Where can I get a copy of the latest draft?
|
There's a link to it on the C++ Standard Committe website at
http://www.open-std.org/jtc1/sc22/wg21/ (the most recent version
currently is
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf)
HTH,
Ganesh
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
kanze Guest
|
Posted: Thu Aug 31, 2006 3:44 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Alberto Ganesh Barbati wrote:
| Quote: | Matthias Hofmann ha scritto:
"Alberto Ganesh Barbati" <AlbertoBarbati (AT) libero (DOT) it> schrieb im Newsbeitrag
news:2F%Ig.86371$zy5.1470746 (AT) twister1 (DOT) libero.it...
Matthias Hofmann ha scritto:
Given that, the expression
T arr[N] = {};
should require an accessible constructor that takes a T as
its argument. This can be a copy constructor or a template
constructor.
Incorrect. As I already wrote in another post, every element
of the array is simply value-initialized.
|
That's what it says in §8.5.1/7. No one is disputing that, and
the differences between default-initialization and
value-initialization aren't relevant here (since neither uses
the copy constructor).
The defect is that in §8.5/12, the standard says explicitly that
copy-initialization (not value-initialization or
default-initialization) is used. Which is a direct
contradiction with §8.5.1/7.
Given both statements, the question is whether for missing
initializers, the statement in §8.5/12 doesn't hold (although I
can't see any reason why not), or whether the intent is that
value-initialization be used to create an initializer (which is
then used according to the rule in §8.5/12). I think that both
interpretations are possible, with the second probably closer to
the meaning of the exact words in the standard.
--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
kanze Guest
|
Posted: Thu Aug 31, 2006 3:44 pm Post subject: Re: Defect Report: Copy-initialization in brace-enclosed ini |
|
|
Alberto Ganesh Barbati wrote:
[...]
| Quote: | §8.5/15 clause 6 does not apply, because clause 3 "Otherwise,
if the destination type is an array, see 8.5.1." is in effect.
The rest of the reasoning is therefore incorrect as it starts
with a wrong assumption.
|
Yes and no. When all is said and done, §8.5.1 says that each
member is initialized with the given expression, which brings us
back to §8.5/15 for the individual members. And §8.5/12 says
that when reading §8.5 for the individual members, the
initialization is copy-initialization. (The example in §8.5.1/7
also says that the individual member of type int is initialized
with int(). Regretfully, it's not normative text.)
--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
---
[ 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.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|