Boost logo

Boost :

Subject: Re: [boost] boost::mpl::for_each and value_initialized
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2010-02-08 06:11:00

>> 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:
> 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

Note that I'm planning to rename the macro to
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 Dekker
Scientific programmer at LKEB, Leiden University Medical Center 

Boost list run by bdawes at, gregod at, cpdaniel at, john at