I appreciate the apology here, and I can totally understand the concern about the spec in a safety critical environment.
Still, all questions on this test except the first are clearly examples of things you should never ever do in production code, which might undermine the message a bit? Yes, you can write bad code, and that’s true in every language I’ve ever used.
I’m guessing it would be hard to find a modern compiler on Windows, Mac or Linux that produced padding other than rounding up to nearest 4 bytes?
Sizeof(a+b) is obviously a weird thing to do.
char a = ‘ ‘ * 13 produces an overflow warning in gcc.
(((((i >= i) << i) >> i) <= i)) I hope nobody really did that.
return i++ + ++i; Not doing exactly this was drilled into us in CS 101. Still, I’d be interested to hear about a compiler that doesn’t return 1, since many people rely on the fact that ++i is pre-increment and i++ is post-increment. I don’t doubt one is out there, I’m curious to know which.
There probably weren’t much better choices 20 years ago... what would be the best choices today for a branch new nuclear power plant?