Remix.run Logo
Joker_vD 3 days ago

> There is no reason why the C/C++ stack can't grow up rather than down.

Historical accident. Imagine if PDP-7/PDP-11 easily allowed for the following memory layout:

    FFFF +---------------+
         |     text      |  X
         +---------------+
         |    rodata     |  R
         +---------------+
         |  data + bss   |  RW
         +---------------+
         |     heap      |
         |      ||       |  RW
         |      \/       |
         +---------------+
         |  empty space  |  unmapped
         +---------------+
         |      /\       |
         |      ||       |  RW
         |     stack     |
    0000 +---------------+
Things could have turned out very differently than they have. Oh well.
3 days ago | parent | next [-]
[deleted]
musicale 2 days ago | parent | prev [-]

Nice diagram. I might put read-only pages on both sides of 0 though to mitigate null pointer effects.