Remix.run Logo
jenadine 10 hours ago

I'm afraid that's still not defined behaviour in many case. For example, pointer and bool can be initialized with `=0`, but that doesn't mean the binary representation in memory has to be 0, and so initializing with memset would still be wrong. (Even if it works with all compilers I know of.)

Also, how does CBase knows the size of its allocated memory?

ksherlock 7 hours ago | parent [-]

The symbian source code is available. Looks like it uses a class-specific operator new() overload.

https://github.com/SymbianSource/oss.FCL.sf.os.kernelhwsrv/b...

2. Initialisation of the CBase derived object to binary zeroes through a specific CBase::operator new() - this means that members, whose initial value should be zero, do not have to be initialised in the constructor. This allows safe destruction of a partially-constructed object.