Re:Should you learn C to “learn how the computer works”?
by swolchok on Tuesday October 02, 2018 @03:45PM
(#18125052)
Why do you claim that local variables and function calls are specific to C? They seem to be very popular among programming languages in general.
[ Parent
| on HN ]
Re:Should you learn C to “learn how the computer works”?
by Annatar on Wednesday October 03, 2018 @02:17AM
(#18128005)
Because I'm an assembler coder, and when one codes assembler by hand, one almost never uses the stack: it's easy for a human to write subroutines in such a way that only the processor registers are used, especially on elegant processor designs which have 16 or 32 registers.
Re:Should you learn C to “learn how the computer works”?
by pjmlp on Wednesday October 03, 2018 @07:00AM
(#18129107)
I surely did use the stack a lot, back in the old days when coding Z80 and 80x86 Assembly.
Re:Should you learn C to “learn how the computer works”?
by Annatar on Wednesday October 03, 2018 @07:18AM
(#18129185)
You almost had to, because both Z80 and x86 processors have a laughably small number of general purpose registers. To write code which works along that limitation would have required lots of care and cleverness, far more than on UltraSPARC and MC68000.
On MOS 6502 we used self-modifying code rather than the stack because it was more efficient and that CPU has no instruction and data caches, so they couldn't be corrupted or invalidated.