简体   繁体   中英

why do we increment/decrement stack pointer by “4” when we push and pop from the program stack?

why do we increment/decrement stack pointer by "4" when we push and pop from the program stack? I am wondering where that "4" comes from.

The 4 is the size of the bytes that are being added on the stack.

Between the old stack address and the new stack address is where your data is being stored.

When you pop, you subtract 4 from the address in order to be able to overwrite the information on the next push.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM