Topic: Slight mistake in C++ Draft Std example
Author: Barry Kleinman <barry@giga-net.com>
Date: 1997/12/31 Raw View
Someone else has probably pointed this out already, or perhaps it's been
corrected in a more recent draft, but just in case...
In section 1.2.8 of Annex 0 [diff.special] of the X3J16/96-0225 document,
the following sample code is presented:
struct X { int i; };
struct X x1, x2;
volatile struct X x3 = {0};
x1 = x3; // invalid C++
x2 = x3; // also invalid C++
It seems to me that the x2 variable demonstrates exactly the same point as
the x1 variable, and is thus redundant. Perhaps the committee meant for
the example to be:
struct X { int i; };
struct X x1;
volatile struct X x2;
volatile struct X x3 = {0};
x1 = x3; // invalid C++
x2 = x3; // also invalid C++
which would demonstrate there's no implicit "X (volatile const X&)" copy
constructor, even for objects declared as volatile.
~~~~~~~~~~~~~~
Barry Kleinman
gigaNET, Inc.
2352 Main Street, Suite 108
Concord MA 01742-3828 USA
1-978-461-0402
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]