News for hackers. Stuff that matters.
Re:Ask HN: Who had the crazy idea to make the stack grow down? by ofalkaed on Saturday September 27, 2025 @07:08PM (#45400116)
I don't think any single person did, they just went with what ever way best suited the hardware/language it is being implemented on/with and the needs of the language being implemented. If stack underflows are rare than growing down means testing for an overflow is always the same regardless of stack size and I assume this is why some languages (like Forth) have -1 as false instead of 0, -1 is an overflow so the languages own true/false can test for an overflow. In languages which are not so directly dealing with the stack, underflows are rare and may not even be possible so having the last element of the stack as stack pointer==0 simplifies things.

There are no comments on this comment yet.