Both free(NULL) and ::operator delete(NULL) are allowed. Does the allocator concept (e.g. std::allocator also allow deallocate(NULL,1), or is it required to put your own guard around it?
Both free(NULL) and ::operator delete(NULL) are allowed. Does the allocator concept (e.g. std::allocator also
Share
You’ll need to add your own check.
According to §20.4.1.1/8,
deallocaterequires:allocatethrows an exception when storage can’t be given (§20.4.1.1/7). In other words,allocatenever returns 0, and thereforedeallocateshould never get a 0. Passing a 0 would lead to undefined behavior.