Hacker News new | ask | show | jobs
by tmurray 5024 days ago
I don't think that is true. If you're writing C, it's probably because you want to be close to the metal and want many of the guarantees that such proximity provides. If you're focused on that sort of thing, then it's definitely useful to understand what your compiler is actually outputting so you can react accordingly.

(I'm a C programmer, I don't look at assembly that often at all, but it's certainly helpful to be able to do so and my knowledge of the x86 ISA, calling conventions, etc has informed many decisions I've made in the past, especially re: performance)

1 comments

If you want to know what GCC is outputting, you need to learn a hell of a lot more than just x86 assembly. You're going to have to do quite a bit of study of compiler theory. Run objdump on some non-trivial C program and the direct flow of logic will not likely directly resemble the C you wrote.
You don't need to study compiler theory to understand the kind of code the compiler will output. That's very easy to reason about, and much harder to implement.

Knowing x86 assembly is more than enough to reason backwards from assembly to the C that generated it.