Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62307 - in trunk: boost/utility libs/utility
From: nielsdekker_at_[hidden]
Date: 2010-05-30 05:19:10

Author: niels_dekker
Date: 2010-05-30 05:19:09 EDT (Sun, 30 May 2010)
New Revision: 62307

Made memset call in value_init conditional, see #3869. Updated the section "compiler issues" of its documentation.
Text files modified:
   trunk/boost/utility/value_init.hpp | 24 ++++++++++-
   trunk/libs/utility/value_init.htm | 82 ++++++++++++++++++++++++++-------------
   2 files changed, 76 insertions(+), 30 deletions(-)

Modified: trunk/boost/utility/value_init.hpp
--- trunk/boost/utility/value_init.hpp (original)
+++ trunk/boost/utility/value_init.hpp 2010-05-30 05:19:09 EDT (Sun, 30 May 2010)
@@ -10,6 +10,7 @@
 // 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola
 // 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola
 // 03 Apr 2010 (Added initialized<T>, suggested by Jeffrey Hellrung, fixing #3472) Niels Dekker
+// 30 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker
@@ -21,6 +22,7 @@
 // contains. More details on these issues are at libs/utility/value_init.htm
 #include <boost/aligned_storage.hpp>
+#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
 #include <boost/detail/workaround.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/cv_traits.hpp>
@@ -41,6 +43,23 @@
+ // Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
+ // suggests that a workaround should be applied, because of compiler issues
+ // regarding value-initialization.
+// Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND
+// switches the value-initialization workaround either on or off.
+ #else
+ #endif
 namespace boost {
 template<class T>
@@ -82,10 +101,9 @@
- // Note: the following memset call will become conditional when ticket #3869 is fixed:
- // reported by Aleksey Gurtovoy.
       std::memset(&x, 0, sizeof(x));
       new (wrapper_address()) wrapper();

Modified: trunk/libs/utility/value_init.htm
--- trunk/libs/utility/value_init.htm (original)
+++ trunk/libs/utility/value_init.htm 2010-05-30 05:19:09 EDT (Sun, 30 May 2010)
@@ -223,37 +223,65 @@
 compiler issues! It's hard to make a general statement on what those issues
 are like, because they depend on the compiler you are using, its version number,
 and the type of object you would like to have value-initialized.
-Compilers usually support value-initialization for built-in types properly.
-But objects of user-defined types that involve <em>aggregates</em> may <em>in some cases</em>
-be partially, or even entirely left uninitialized, when they should be value-initialized.
+All compilers we have tested so far support value-initialization for arithmetic types properly.
+However, various compilers may leave some types of <em>aggregates</em> uninitialized, when they
+should be value-initialized. Value-initialization of objects of a pointer-to-member type may also
+go wrong on various compilers.
-We have encountered issues regarding value-initialization on compilers by
-Microsoft, Sun, Borland, and GNU. Here is a list of bug reports on those issues:
-<table summary="Compiler bug reports regarding value-initialization" border="0" cellpadding="7" cellspacing="1" >
-<a href="">
-Microsoft Feedback ID 100744 - Value-initialization in new-expression</a>
-<br>Reported by Pavel Kuznetsov (MetaCommunications Engineering), 2005-07-28
-<a href="">
-GCC Bug 30111 - Value-initialization of POD base class doesn't initialize members</a>
-<br>Reported by Jonathan Wakely, 2006-12-07
-<a href="">
-GCC Bug 33916 - Default constructor fails to initialize array members</a>
-<br>Reported by Michael Elizabeth Chastain, 2007-10-26
-<a href="">
-Borland Report 51854 - Value-initialization: POD struct should be zero-initialized</a>
-<br>Reported by Niels Dekker (LKEB, Leiden University Medical Center), 2007-09-11
+At the moment of writing, May 2010, the following reported issues regarding
+value-initialization are still there in current compiler releases:
+<a href="">
+Microsoft Visual Studio Feedback ID 100744, Value-initialization in new-expression</a>
+<br>Reported by Pavel Kuznetsov (MetaCommunications Engineering), 2005
+<a href="">
+Microsoft Visual Studio Feedback ID 484295, VC++ does not value-initialize members of derived classes without user-declared constructor</a>
+<br>Reported by Sylvester Hesp, 2009
+<a href="">
+Microsoft Visual Studio Feedback ID 499606, Presence of copy constructor breaks member class initialization</a>
+<br>Reported by Alex Vakulenko, 2009
+<a href="">
+Embarcadero/C++Builder Report 83751, Value-initialization: arrays should have each element value-initialized</a>
+<br>Reported by Niels Dekker (LKEB), 2010
+<a href="">
+Embarcadero/C++Builder Report 83851, Value-initialized temporary triggers internal backend error C1798</a>
+<br>Reported by Niels Dekker, 2010
+<a href="">
+Embarcadero/C++Builder Report 84279, Internal compiler error (F1004), value-initializing member function pointer by "new T()"</a>
+<br>Reported by Niels Dekker, 2010
+Sun CR 6947016, Sun 5.10 may fail to value-initialize an object of a non-POD aggregate.
+<br>Reported to Steve Clamage by Niels Dekker, 2010
+IBM's XL V10.1 and V11.1 may fail to value-initialize a temporary of a non-POD aggregate.
+<br>Reported to Michael Wong by Niels Dekker, 2010
+Intel support issue 589832, Attempt to value-initialize pointer-to-member triggers internal error
+on Intel 11.1.
+<br>Reported by John Maddock, 2010
+Note that all known GCC issues regarding value-initialization are
+fixed with GCC version 4.4, including
+GCC Bug 30111.
+Clang also has completely implemented value-initialization, as far as we know,
+now that Clang Bug 7139 is fixed.
 New versions of <code>value_initialized</code>
 (Boost release version 1.35 or higher)
-offer a workaround to these issues: <code>value_initialized</code> will now clear
-its internal data, prior to constructing the object that it contains.
+offer a workaround to these issues: <code>value_initialized</code> may now clear
+its internal data, prior to constructing the object that it contains. It will do
+so for those compilers that need to have such a workaround, based on the
+<a href="../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_defects"
 <h2><a name="types"></a>Types and objects</h2>
@@ -463,7 +491,7 @@
-<p>Revised 1 May 2010</p>
+<p>Revised 30 May 2010</p>
 <p>&copy; Copyright Fernando Cacciola, 2002 - 2010.</p>

Boost-Commit list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at