Useless, but interesting. I used to work with somebody who would ask: What happens with this code?
#include <iostream>
int main() {
const char *p = 0;
std::cout << p;
}
You might answer "it's undefined behavior, so there is no point reasoning about what happens." Is it undefined behavior?
The idea behind this question was to probe at the candidate's knowledge of the sorts of things discussed in the article: virtual memory, signals, undefined behavior, machine dependence, compiler optimizations. And edge cases in iostream.
I didn't like this question, but I see the point.
FWIW, on my machine, clang produces a program that segfaults, while gcc produces a program that doesn't. With "-O2", gcc produces a program that doesn't attempt any output.