5 ms·
Minor quibble: The section on local variables assumes a downward-growing stack. This is completely fair, because the introduction specifies that the articles d
by mangamadaiyan 6y ago
Minor quibble:
The section on local variables assumes a downward-growing stack. This is completely fair, because the introduction specifies that the articles deal with an x86 world. What gets missed out is the fact that the direction of stack growth is determined by the processor :)
This is not really a complaint ... it just seemed to me like a missed opportunity to mention something interesting.
- Someone 6y agoMinor quibble: The section on local variables assumes a stack. This is completely fair, because the introduction specifies that the articles deal with an x86 world and ABI. What gets missed out is the fact that the C standard doesn’t even prescribe (edited) the existence of a stack. (Just checked the final draft of ISO C2011. As far as I can tell, it doesn’t contain the word stack, and only uses push in the description of (w)ungetc. I also don’t think there’s wording about performance or ordering of addresses of local variables across frames that effectively enforces the use of a stack. I think it is still perfectly fine to use a linked list of environments for local variables) This is not really a complaint ... it just seemed to me like a missed opportunity to mention something interesting. :-)
- mangamadaiyan 6y agoPerhaps you meant "prescribe" instead of "proscribe"? :)
- Someone 6y agoYos :). Fixed. Thanks.
- userbinator 6y agoTry to name one processor with an upward-growing stack... I bet most people who are otherwise familiar with this material can't. (I'm not saying you're wrong --- I personally know two ;-)
- Someone 6y agoAFAIK, PowerPC doesn’t have a stack (or a one-address one that wraps around called the link register); its ABI typically defines one, and that can grow either way, but typically grows down. Not really having a stack ‘preference’ in the CPU isn’t uncommon for pure RISC architectures, where having an instruction that both jumps and writes a return address to memory is a no-no.
- netmonk 6y agoIsn't it Alpha processor in this set ?
- NonEUCitizen 6y agoWhich two, and what's the installed base for those two processors?
- userbinator 6y ago1. HP PA-RISC. "Big RISC" of the mid 80s-90s. Now practically dead. 2. Intel 8051. 8-bit microcontroller which now is found as a core in countless SoCs long after Intel stopped making them. You probably own and use something every day which has an 8051 or 8051-core MCU in it.
- duskwuff 6y agoThe 8051 is a weird enough architecture, especially by modern standards, that having an upward-growing stack is barely even a footnote. (Examples of its weirdness: it only has one general-purpose register; it has three address spaces, some of which are bank-switched; every register other than the program counter exists in memory; some memory locations are bit-addressable...)
- pjc50 6y agoMicrochip PIC16 has similar weird features - some versions have a fixed hardware stack of maximum 8 entries.