Re: [boost] boost::mpl::for_each and value_initialized

I'm sorry, MSVC bug #100744 is still there, even though #335987 has been fixed. VC9 deals with POD types correctly, but may not do so for non-POD aggregate class types.
Domagoj Saric wrote:
but if this is so, shouldn't the proposed patch atleast be modified to:
#ifdef BOOST_VALUE_INITIALIZATION_NEEDS_MEMSET if ( !( ( _MSC_VER >= 1500 ) && ( is_pod<T>::value ) ) ) std::memset(&x, 0, sizeof(x));
#endif ?
I would consider that a refinement. But it's not that simple. MSVC does value-initialize a lot of non-POD types correctly! (But not all of them.) Other compilers may value-initialize built-in types correctly, but not aggregates. I can't remember exactly. So I'd rather start by committing the simple fix that I proposed at Aleksey's ticket #3869, "Unconditional call to memset in value_initialized()", https://svn.boost.org/trac/boost/ticket/3869 Note that I'm planning to rename the macro to BOOST_NO_PROPER_VALUE_INITIALIZATION_FOR_ALL_TYPES. I hope that's okay. But before I commit I'll have to write unit tests for this macro, as John explained to me. I'm planning to do so later this month. When all that is done and stabilized, I wouldn't mind looking at some possible fine tuning, to further reduce the number of memset calls. But I'm afraid it will be a maintainer's headache. Kind regards, Niels -- Niels Dekker http://www.xs4all.nl/~nd/dekkerware Scientific programmer at LKEB, Leiden University Medical Center

"Niels Dekker - address until 2010-10-10" <niels_address_until_2010-10-10@xs4all.nl> wrote in message news:07DF713EB75448E9BB19C125D30B356E@lumcnet.prod.intern...
I would consider that a refinement. But it's not that simple. MSVC does value-initialize a lot of non-POD types correctly! (But not all of them.) Other compilers may value-initialize built-in types correctly, but not aggregates. I can't remember exactly.
Yes but if MSVC certainly always does correctly value_initialize PODs then it seems like a safe and rather simple first step...then later, as you said, more specific logic can be added...
When all that is done and stabilized, I wouldn't mind looking at some possible fine tuning, to further reduce the number of memset calls. But I'm afraid it will be a maintainer's headache.
Very well... -- "That men do not learn very much from the lessons of history is the most important of all the lessons of history." Aldous Huxley
participants (2)
-
Domagoj Saric
-
Niels Dekker - address until 2010-10-10