Alex Rivera | Logout

Stacks - why PUSH and POP?

Asked 2009-01-07T13:35:38.607
15

I was wondering why we use the terms "push" and "pop" for adding/removing items from stacks? Is there some physical metaphor that caused those terms to be common?

The only suggestion I have is something like a spring-loaded magazine for a handgun, where rounds are "pushed" into it and can be "popped" out, but that seems a little unlikely.

A second stack trivia question: Why do most CPUs implement the call stack as growing downwards in memory, rather than upwards?

Edit
Report

1 Answer

0

As to stacks growing downwards in memory, remember that When dealing with hierarchical data structures (trees), most programmers are happy to draw one on a page with the base (or trunk) at the top of the page...

answered 2009-01-07T14:00:26.547

Your Answer