
Martin Bonner wrote:
You may be able to do a little better. The standard says "The storage for objects with static storage duration (3.7.1) shall be zeroinitialized (8.5) before any other initialization takes place." What is more, most normal operating systems give programs pages of memory that are zero-initialized, so compilers would have to do work to avoid this.
Sorry, I do not understand "so compilers would have to do work to avoid this". Could you please try to state it with different wording?
I think that means you can declare constructors and STILL have the object well behaved.
Do you mean: the object might be already zero initialized before the ctor runs? If yes: this is very dangerous to rely on! 1) "Might": the standard does not require it. 2) E.g.: MSVC initializes memory to "CDCDCDCDCDCD...." in debugging builds, so there is at least one prominent case where the assumption is false. Roland