|n.||1.||A large and to some degree orderly pile of hay, grain, straw, or the like, usually of a nearly conical form, but sometimes rectangular or oblong, contracted at the top to a point or ridge, and sometimes covered with thatch.|
|2.||An orderly pile of any type of object, indefinite in quantity; - used especially of piles of wood. A stack is usually more orderly than a |
|3.||A pile of wood containing 108 cubic feet.|
|4.||A large quantity; |
|5.||(Arch.) A number of flues embodied in one structure, rising above the roof.|
|6.||(Computer programming) A section of memory in a computer used for temporary storage of data, in which the last datum stored is the first retrieved.|
|7.||The section of a library containing shelves which hold books less frequently requested.|
|v. t.||1.||To lay in a conical or other pile; to make into a large pile; |
|2.||To place in a vertical arrangement so that each item in a pile is resting on top of another item in the pile, except for the bottom item; |
|3.||To select or arrange dishonestly so as to achieve an unfair advantage; |
|Noun||1.||stack - an orderly pile|
|2.||stack - (often followed by `of') a large number or amount or extent; "a batch of letters"; "a deal of trouble"; "a lot of money"; "he made a mint on the stock market"; "it must have cost plenty"|
|3.||stack - a list in which the next item to be removed is the item most recently stored (LIFO)|
|4.||stack - a large tall chimney through which combustion gases and smoke can be evacuated|
|5.||stack - a storage device that handles data so that the next item to be retrieved is the item most recently stored (LIFO)|
|Verb||1.||stack - load or cover with stacks; "stack a truck with boxes"|
|2.||stack - arrange in stacks; "heap firewood around the fireplace"; "stack your books up on the shelves"|
|3.||stack - arrange the order of so as to increase one's winning chances; "stack the deck of cards"|
|(programming)||stack - (See below for synonyms) A data structure for
storing items which are to be accessed in last-in first-out
The operations on a stack are to create a new stack, to "push" a new item onto the top of a stack and to "pop" the top item off. Error conditions are raised by attempts to pop an empty stack or to push an item onto a stack which has no room for further items (because of its implementation).
Most processors include support for stacks in their instruction set architectures. Perhaps the most common use of stacks is to store subroutine arguments and return addresses. This is usually supported at the machine code level either directly by "jump to subroutine" and "return from subroutine" instructions or by auto-increment and auto-decrement addressing modes, or both. These allow a contiguous area of memory to be set aside for use as a stack and use either a special-purpose register or a general purpose register, chosen by the user, as a stack pointer.
The use of a stack allows subroutines to be recursive since each call can have its own calling context, represented by a stack frame or activation record. There are many other uses. The programming language Forth uses a data stack in place of variables when possible.
Although a stack may be considered an object by users, implementations of the object and its access details differ. For example, a stack may be either ascending (top of stack is at highest address) or descending. It may also be "full" (the stack pointer points at the top of stack) or "empty" (the stack pointer points just past the top of stack, where the next element would be pushed). The full/empty terminology is used in the Acorn Risc Machine and possibly elsewhere.
In a list-based or functional language, a stack might be implemented as a linked list where a new stack is an empty list, push adds a new element to the head of the list and pop splits the list into its head (the popped element) and tail (the stack in its modified form).
At MIT, pdl used to be a more common synonym for stack, and this may still be true. Knuth ("The Art of Computer Programming", second edition, vol. 1, p. 236) says:
Many people who realised the importance of stacks and queues independently have given other names to these structures: stacks have been called push-down lists, reversion storages, cellars, dumps, nesting stores, piles, last-in first-out ("LIFO") lists, and even yo-yo lists!