According to cplusplus.com:
My question is, since it says memory is not initialized does this mean that class constructors, even the default constructor isn't called?
I have been working on a Quadtree and I want to know if the default constructor will be called when malloc is used to create space for new nodes.
Quote
void * malloc ( size_t size );
Allocate memory block
Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
If size is zero, the return value depends on the particular library implementation (it may or may not be a null pointer), but the returned pointer shall not be used to dereference an object in any case.
Allocate memory block
Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
If size is zero, the return value depends on the particular library implementation (it may or may not be a null pointer), but the returned pointer shall not be used to dereference an object in any case.
My question is, since it says memory is not initialized does this mean that class constructors, even the default constructor isn't called?
I have been working on a Quadtree and I want to know if the default constructor will be called when malloc is used to create space for new nodes.