Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-10-30 05:47:52


Anthony Williams wrote:
> No. This is required. The memory for an object with static-storage-duration
> MUST be zero initialized prior to the constructor running.
>
>> 1) "Might": the standard does not require it.
>
> Wrong.

You are obviously misunderstanding me.
Of course are static objects zero initialized. I had the impression that
the original poster meant that this would be a general case for
dynamic objects as well on some compilers. And this is waht I meant by
"might". Did you get me now?

>> 2) E.g.: MSVC initializes memory to "CDCDCDCDCDCD...." in debugging
>> builds, so there is at least one prominent case where the
>> assumption is false.
>
> It does this for automatic and heap-allocated objects (which is allowed). If
> it did it for static objects, it would be non-conforming.

Same than before.

But the problem is a different one:
Even a static zero initialized ähm memory area, is not a object until
its ctor has been run! And since my mutex proposal tries to implement
a mutex that is valid before ctor runs have been completed, only POD's
can be used.

Does this make sense?

Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk