Is it still safe to delete nullptr in c++0x?

5.3.5/7 says: If the value of the operand of the delete-expression is not a null pointer value, the delete-expression will call a deallocation function (3.7.4.2). Otherwise, it is unspecified whether the deallocation function will be called. And 3.7.4.2/3 says: The value of the first argument supplied to a deallocation function may be a null pointer … Read more

Is null reference possible?

References are not pointers. 8.3.2/1: A reference shall be initialized to refer to a valid object or function. [Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes … Read more

Is std::stoi actually safe to use?

Does std::stoi throw an error on the input “abcxyz”? Yes. I think your confusion may come from the fact that strtol never reports an error except on overflow. It can report that no conversion was performed, but this is never referred to as an error condition in the C standard. strtol is defined similarly by all three C standards, and I will spare … Read more

Is std::stoi actually safe to use?

Does std::stoi throw an error on the input “abcxyz”? Yes. I think your confusion may come from the fact that strtol never reports an error except on overflow. It can report that no conversion was performed, but this is never referred to as an error condition in the C standard. strtol is defined similarly by all three C standards, and I will spare … Read more