nothrow new (which should not be used, by the way) returns null pointer if memory cannot be allocated (which cannot happen on majority of modern OS using virtual memory and lazy allocation).
Second line checks if pointer returned by nothrow new is null popinter and output message if it is and allocation failed.
does nothrow already handles the situation in case the p fails to be allocated?
It does not handle situation. It suppresses (or does not emit in first place) exception if allocation fails and returns null pointer. YOu still need to handle failure: either by capturing or not capturing exception with notmal new, or checking result with nothrow new.