4 ms·
Comparing C to python, the lack of explicit memory management and pointers in python make it hard to understand what the machine is actually doing compared to w
by habnds 7y ago
Comparing C to python, the lack of explicit memory management and pointers in python make it hard to understand what the machine is actually doing compared to writing in C.
Are there equivalent examples between C and assembler? What sort of conceptual stuff is C missing that assembler clarifies?
- ginko 7y agoCalling conventions, inlining, understanding the cost of indirect function calls.
- foota 7y agoYou could argue it's not conceptual, but you don't have to deal with registers in C. Also system calls. C handles dynamic library loading, I think. Not too familiar with how that works in assembly.
- kazinator 7y agoYou have to deal with those register when debugging C, at least from time to time. C debuggers show you the registers; e.g. "info reg" in the GNU debugger. Linux kernel debugging often means working from a dump of the CPU registers, raw memory around the stack pointer, and surrounding the instruction pointer. From that you figure out what bad thing the C code did.
- pjmlp 7y agoSIMD, registers (you can do clever stuff with direct control of them), and lots of opcodes that aren't exposed to C.
- GoblinSlayer 7y agoAssembler specifies what actually happens. What is undefined behavior, again?
- kazinator 7y agoAlthough that lower level stuff (like calling conventions and register use) is missing in C, you have to deal with it when debugging C. C programmers know how to debug at the machine level. By contrast, the average Python programmer couldn't debug into the Python internals if their life depended on it.