Why does the stack address grow towards decreasing memory addresses?

前端 未结 4 527
半阙折子戏
半阙折子戏 2020-11-28 04:36

I read in text books that the stack grows by decreasing memory address; that is, from higher address to lower address. It may be a bad question, but I didn\'t get the concep

4条回答
  •  -上瘾入骨i
    2020-11-28 05:15

    On x86, the primary reason the stack grows toward decreasing memory addresses is that the PUSH instruction decrements the stack pointer:

    Decrements the stack pointer and then stores the source operand on the top of the stack.

    See p. 4-511 in Intel® 64 and IA-32 ArchitecturesSoftware Developer’s Manual.

提交回复
热议问题