Will new return NULL in any case?
问题 I know that according to C++ standard in case the new fails to allocate memory it is supposed to throw std::bad_alloc exception. But I have heard that some compilers such as VC6 (or CRT implementation?) do not adhere to it. Is this true ? I am asking this because checking for NULL after each and every new statement makes code look very ugly. 回答1: VC6 was non-compliant by default in this regard. VC6's new returned 0 (or NULL ). Here's Microsoft's KB Article on this issue along with their