3 ms·
> C helps you think like a computer I recently bought K&R, doing a bit of micro-controller stuff without the Arduino abstractions, and this I can agree with. I
by MrBuddyCasino 10y ago
> C helps you think like a computer
I recently bought K&R, doing a bit of micro-controller stuff without the Arduino abstractions, and this I can agree with. I now have an idea how code really gets executed on a CPU, and how the contract between the bare metal and the assembler code for doing so looks like.
That the concept of a stack is built into x86, and why calling conventions are important, all of this stuff I had no idea doing Java development for all these years. What do I need a linker for? Object files, what?
I don't really like it, but there is something strangely beautiful about it - if you look hard enough, you can see the machine shining through the unforgiving cold blue ice that is C.
- leppr 10y ago>calling conventions are important Curious what you mean by that, in what way learning C made you understand this better than Java or any other language did?
- MrBuddyCasino 10y agoAs mentioned, I don't particularly like C, so I've explored Rust a bit. I tried to expose a Rust function to C, heres the signature: #[no_mangle] pub extern "C" fn count_substrings(value: *const c_char, substr: *const c_char) -> i32 So I came at it from the opposite direction, and once you go down the rabbit hole of what "no_mangle" and "extern C" does, thats where it leads you. Along the way you inevitably pick up topics like alignment and struct packing.
- pjmlp 10y agoI had the same experience with low level machine control using compilers for dialects of Basic and Pascal, back in the mid-80's early 90's.