News for hackers. Stuff that matters.
Re:C++ Programming Questions to Ask on Interview (2017) by jemfinch on Friday October 19, 2018 @08:35AM (#18256255)
> It's an invariant of the 'DirectorySearchResult' class that query is non-null, as the destructor deletes it without checking it for nullity.

Deleting a null pointer is a fully specified no-op in C++.

Re:C++ Programming Questions to Ask on Interview (2017) by lemmyg on Friday October 19, 2018 @02:17PM (#18258764)
That's true. And I see the other example answers they have written do assume the pointer can be null, although the original class makes no indication of this.

To make the question clearer they should have added a function on the original class that checks (or doesn't check) the pointer before dereferencing it, thereby clarifying whether query being null is valid or not.