Re: Inadequate error message C2228
- From: "Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx>
- Date: Thu, 17 Apr 2008 08:21:44 -0400
Vladimir Grigoriev wrote:
"Cezary H. Noweta" <chncc@xxxxxxxxxxxxxxx> wrote in message
news:ugTNvN$nIHA.3376@xxxxxxxxxxxxxxxxxxxxxxx
Yes, but (B(a)) still can be (and really it is) optimized to B(a),
thus copy ctor will be omitted. In ((void)0, B(A)) copy ctor could
be omitted too (there is no sequence point after a whole
expression), but hopefully compilers are not happy to do this.
Certainly, the safest way to call the copy ctor is to introduce a
temporary object manually.
It is interesting to note that different compilers behave differently.
Visual C++ 2003 EE omits copy ctor for the statement
B b( ( B( a ) ) );
while BCB 5.0 calls copy ctor as it is specified explicitly.
I for one do not share your view that this is "interesting". So what
if the compilers have different ways of implementing this. All within
allowed behaviour, according to the Standard... What might be (or is)
interesting is how many programmers do not know that making a copy
is allowed to be omitted and try to rely on the copy's being made...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- References:
- Inadequate error message C2228
- From: Vladimir Grigoriev
- Re: Inadequate error message C2228
- From: Victor Bazarov
- Re: Inadequate error message C2228
- From: Vladimir Grigoriev
- Re: Inadequate error message C2228
- From: Cezary H. Noweta
- Re: Inadequate error message C2228
- From: Victor Bazarov
- Re: Inadequate error message C2228
- From: Cezary H. Noweta
- Re: Inadequate error message C2228
- From: Vladimir Grigoriev
- Inadequate error message C2228
- Prev by Date: Re: safe alternative to va_arg
- Next by Date: Re: safe alternative to va_arg
- Previous by thread: Re: Inadequate error message C2228
- Next by thread: How should I access _MAX__TIME64_T?
- Index(es):
Relevant Pages
|