Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

This is a perfect example of what I hate about some tests.

Didn't quite know the purpose of the test, there's a difference between code for any machine and any compiler and gcc running on some vanilla x86, which is pretty common, and could have been the content (ex: you say it's undefined, that's obvious, everyone knows that already, but it's still deterministic... Here's a breakdown of what happens in practice, blah blah blah). There's a real difference between the kind of "knowing" here and say the kind of "knowing" with unallocated pointers.

If it said "esoteric implementation on exotic hardware" then it's easy, you know what they are trying to do. If it said C89 you also know what's up. But how it's presented, it's a guess.

This was endemic throughout schooling. Instructors would say "just do your best" and I'd be like "wtf? There's like 2,3, maybe 4 perspectives on this with different answers depending on how clever you're trying to be or what you're trying to get at... Might as well put "I'm thinking of a number 1 through 5" on the exam".



You can easily get bitten by at least one of those examples just by compiling your application written on x86 to ARM to get it running on Android, so not sure if it's as esoteric as you think.


Or on different compilers, or the same compiler with different options, etc.


Or a new release of the same compiler.


But the test doesn't ask about C as compiled by X compiler on Y architecture. It just asks about C.

(You also seem to be assuming GCC is more predictable about undefined behaviour than it actually is.)


> but it's still deterministic

That's an assumption though. If it's undefined, the result may even depend on the order of some internal hash table which is affected by other code.


>but it's still deterministic

Undefined behavior means the standard says demons can fly out of your nose. Those demons might behave nondeterministically.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: