Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > What is a stack?

Reply
Thread Tools

What is a stack?

 
 
spinoza1111
Guest
Posts: n/a
 
      05-29-2010
Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
and I am an IT and nursing student in Manila. My teacher uses the word
"stack". What does she mean?
 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      05-29-2010

"spinoza1111" wrote:

> Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
> and I am an IT and nursing student in Manila. My teacher uses the word
> "stack". What does she mean?


Well, princess, only your teacher knows what she means when she uses a word.
Here are two possible meanings:

o A stack, as in a stack of pancakes.
o A woman, often young, with appealing mammary glands. Unfortunately, due to
one warped old man (Hugh Hefner) and his impact on the culture, appealing is
oftentimes equated to "large".


 
Reply With Quote
 
 
 
 
Seebs
Guest
Posts: n/a
 
      05-29-2010
On 2010-05-29, osmium <(E-Mail Removed)> wrote:
> "spinoza1111" wrote:
>> Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,


Why did you respond to the obvious fakepost from Nilges?

Admittedly, yours was funny in a way that hers wasn't.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
 
Reply With Quote
 
spinoza1111
Guest
Posts: n/a
 
      05-30-2010
On May 30, 3:04*am, Seebs <(E-Mail Removed)> wrote:
> On 2010-05-29, osmium <(E-Mail Removed)> wrote:
>
> > "spinoza1111" wrote:
> >> Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,

>
> Why did you respond to the obvious fakepost from Nilges?
>
> Admittedly, yours was funny in a way that hers wasn't.


Perhaps. But can you define a stack?
>
> -s
> --
> Copyright 2010, all wrongs reversed. *Peter Seebach / (E-Mail Removed)://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


 
Reply With Quote
 
spinoza1111
Guest
Posts: n/a
 
      05-30-2010
On May 30, 3:06*pm, "io_x" <(E-Mail Removed)> wrote:
> a stack is a common array of memory where is defined the functions push()
> and pop() [and descrive what the functions do]


Pretty good, not bad, but could be better
First of all, you shouldn't the meaning so to fetter
To a "common" region of allocation
To do so is itself common, and and instance of inanition.
A stack can be a private thing and not for the public eye
Like when you're hungry and eat a whole pizza pie.

Nor 'tis it by necessity
An array...ain't pretty.
It can be a list what is linked
Just don't mess it up as does Heathfield whose tool, stinked.

And your worst error was that you left the interesting part
Subject to the student's random brain fart.
You do not define push and you don't define pull
That is how you look like, well, sort of a fool.

A stack is a data set,
A collection of items without predefined order,
Which can be accessed only at one end.
It's not a mouth and an anus
Nor is it a moon or Uranus,
But the top element can be removed by means of an operation called
onomatopoeiatistically , pop
And an element can be added by another operation called push, and push
and pop can be used in principle and sub specie aeternitatis, without
stop.

Managers do not love stacks
Great programmers like them
Managers fear that a sort of collection of hacks
Or, a Communist conspiracy, ahem,
Lurks in the very idea of separation of concerns
It gives managers heart burns.
A stack says, get back to later,
Alligator,
Once I've solved another problem.
>
> "spinoza1111" <(E-Mail Removed)> ha scritto nel messaggionews:(E-Mail Removed)...
>
>
>
> > Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
> > and I am an IT and nursing student in Manila. My teacher uses the word
> > "stack". What does she mean?


 
Reply With Quote
 
spinoza1111
Guest
Posts: n/a
 
      05-30-2010
On May 30, 9:19*pm, spinoza1111 <(E-Mail Removed)> wrote:
> On May 30, 3:06*pm, "io_x" <(E-Mail Removed)> wrote:
>
> > a stack is a common array of memory where is defined the functions push()
> > and pop() [and descrive what the functions do]

>
> Pretty good, not bad, but could be better
> First of all, you shouldn't the meaning so to fetter
> To a "common" region of allocation
> To do so is itself common, and and instance of inanition.
> A stack can be a private thing and not for the public eye
> Like when you're hungry and eat a whole pizza pie.
>
> Nor 'tis it by necessity
> An array...ain't pretty.
> It can be a list what is linked
> Just don't mess it up as does Heathfield whose tool, stinked.
>
> And your worst error was that you left the interesting part
> Subject to the student's random brain fart.
> You do not define push and you don't define pull
> That is how you look like, well, sort of a fool.
>
> A stack is a data set,
> A collection of items without predefined order,
> Which can be accessed only at one end.
> It's not a mouth and an anus
> Nor is it a moon or Uranus,
> But the top element can be removed by means of an operation called
> onomatopoeiatistically , pop
> And an element can be added by another operation called push, and push
> and pop can be used in principle and sub specie aeternitatis, without
> stop.
>
> Managers do not love stacks
> Great programmers like them
> Managers fear that a sort of collection of hacks
> Or, a Communist conspiracy, ahem,
> Lurks in the very idea of separation of concerns
> It gives managers heart burns.
> A stack says, get back to later,
> Alligator,
> Once I've solved another problem.
>
>
>
>
>
> > "spinoza1111" <(E-Mail Removed)> ha scritto nel messaggionews:(E-Mail Removed)...

>
> > > Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
> > > and I am an IT and nursing student in Manila. My teacher uses the word
> > > "stack". What does she mean?


Revised Poem about Stacks

Pretty good, not bad, but could be better
First of all, you shouldn't the meaning so to fetter
To a "common" region of allocation
To do so is itself common, and and instance of inanition.
A stack can be a private thing and not for the public eye
Like when you're hungry and eat a whole pizza pie.

Nor 'tis it by necessity
An array...ain't pretty.
It can be a list what is linked
Just don't mess it up as does Heathfield whose tool, stinked.

And your worst error was that you left the interesting part
Subject to the student's random brain fart.
You do not define push and you don't define pull
That is how you look like, well, sort of a fool.

A stack is a data set,
A collection of items without predefined order,
Which can be accessed only at one end.
It's not a mouth and an anus
Nor is it a moon of Uranus,
But the top element can be removed by means of an operation called
onomatopoeiatistically , pop
And an element can be added by another operation called push, and
push
and pop can be used in principle and sub specie aeternitatis, without
stop.

Managers do not love stacks
Great programmers like them
Managers fear that a sort of collection of hacks
Or, a Communist conspiracy, ahem,
Lurks in the very idea of separation of concerns
It gives managers heart burns.
A stack says, get back to ya later,
Alligator,
Once I've solved another problem.

The stack is a scandal, and the stack is a shame
For those who think that programming is a child's game
Who get a job as a senior software engineer,
And sneer,
At Schildt because they think he's queer,
Without having the guts to take computer science
Lest Mommy's little darling have to suffer the defiance
Of some prof who doesn't think he's a genius
Who think in fact he's a weirdo and a wuss.

You see, the American university
Teaches the little darlings that anything expressed parenthetically
Can be disregarded by the high level hotshots they aspire to be.
Whereas the stack declares that God is in the details
Inside those cute little parentheses with their funny little tails
Even as Mies von der Rohe
Said, take care of everything thoroughly.
 
Reply With Quote
 
spinoza1111
Guest
Posts: n/a
 
      05-30-2010
On May 30, 9:40*pm, spinoza1111 <(E-Mail Removed)> wrote:
> On May 30, 9:19*pm, spinoza1111 <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On May 30, 3:06*pm, "io_x" <(E-Mail Removed)> wrote:

>
> > > a stack is a common array of memory where is defined the functions push()
> > > and pop() [and descrive what the functions do]

>
> > Pretty good, not bad, but could be better
> > First of all, you shouldn't the meaning so to fetter
> > To a "common" region of allocation
> > To do so is itself common, and and instance of inanition.
> > A stack can be a private thing and not for the public eye
> > Like when you're hungry and eat a whole pizza pie.

>
> > Nor 'tis it by necessity
> > An array...ain't pretty.
> > It can be a list what is linked
> > Just don't mess it up as does Heathfield whose tool, stinked.

>
> > And your worst error was that you left the interesting part
> > Subject to the student's random brain fart.
> > You do not define push and you don't define pull
> > That is how you look like, well, sort of a fool.

>
> > A stack is a data set,
> > A collection of items without predefined order,
> > Which can be accessed only at one end.
> > It's not a mouth and an anus
> > Nor is it a moon or Uranus,
> > But the top element can be removed by means of an operation called
> > onomatopoeiatistically , pop
> > And an element can be added by another operation called push, and push
> > and pop can be used in principle and sub specie aeternitatis, without
> > stop.

>
> > Managers do not love stacks
> > Great programmers like them
> > Managers fear that a sort of collection of hacks
> > Or, a Communist conspiracy, ahem,
> > Lurks in the very idea of separation of concerns
> > It gives managers heart burns.
> > A stack says, get back to later,
> > Alligator,
> > Once I've solved another problem.

>
> > > "spinoza1111" <(E-Mail Removed)> ha scritto nel messaggionews:(E-Mail Removed)...

>
> > > > Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
> > > > and I am an IT and nursing student in Manila. My teacher uses the word
> > > > "stack". What does she mean?

>
> Revised Poem about Stacks
>
> Pretty good, not bad, but could be better
> First of all, you shouldn't the meaning so to fetter
> To a "common" region of allocation
> To do so is itself common, and and instance of inanition.
> A stack can be a private thing and not for the public eye
> Like when you're hungry and eat a whole pizza pie.
>
> Nor 'tis it by necessity
> An array...ain't pretty.
> It can be a list what is linked
> Just don't mess it up as does Heathfield whose tool, stinked.
>
> And your worst error was that you left the interesting part
> Subject to the student's random brain fart.
> You do not define push and you don't define pull
> That is how you look like, well, sort of a fool.
>
> A stack is a data set,
> A collection of items without predefined order,
> Which can be accessed only at one end.
> It's not a mouth and an anus
> Nor is it a moon of Uranus,
> But the top element can be removed by means of an operation called
> onomatopoeiatistically , pop
> And an element can be added by another operation called push, and
> push
> and pop can be used in principle and sub specie aeternitatis, without
> stop.
>
> Managers do not love stacks
> Great programmers like them
> Managers fear that a sort of collection of hacks
> Or, a Communist conspiracy, ahem,
> Lurks in the very idea of separation of concerns
> It gives managers heart burns.
> A stack says, get back to ya later,
> Alligator,
> Once I've solved another problem.
>
> The stack is a scandal, and the stack is a shame
> For those who think that programming is a child's game
> Who get a job as a senior software engineer,
> And sneer,
> At Schildt because they think he's queer,
> Without having the guts to take computer science
> Lest Mommy's little darling have to suffer the defiance
> Of some prof who doesn't think he's a genius
> Who think in fact he's a weirdo and a wuss.
>
> You see, the American university
> Teaches the little darlings that anything expressed parenthetically
> Can be disregarded by the high level hotshots they aspire to be.
> Whereas the stack declares that God is in the details
> Inside those cute little parentheses with their funny little tails
> Even as Mies von der Rohe
> Said, take care of everything thoroughly.


Johnny: Mister Science! Mister Science! What is a stack? Petey Seebach
says they are a Communist Conspiracy!

Mister Science: Well, Johnny, let a list be a set that can contain
duplicates; since you've already read Principia Mathematica,
Grundgezetze der Arithmetik, and Set Theory and Its Logic, you know
that a set is an unordered collection of things that cannot contain
duplicates. A stack is a list, then, over which only the operations
pop() and push(x) are defined. pop() deletes the "top" element of the
list (you will shortly learn the meaning of the word "top" in this
context). If the stack is empty, pop() may be implemented as a no
operation, but for best results should signal or raise an error.
push() adds an element to the stack. Now, what is the "top" element of
a stack? First of all, let the stack be empty.

Johnny: OK!

Mister Science: push(x) followed by pop() will result in an empty
stack.

Johnny: Wow!

Mister Science: Furthermore, if pop is defined as a function, its
value will be x.

Johnny: Cool!

Mister Science: More generally, the second will be true of any stack
no matter how many elements it contains. As long as these assertions,
and no other, hold, the data structure is a stack. The stack can be an
array, it can be a linked list, it can be bugger all if I care as long
as these assertions are satisfied.

Johnny: OOOOO you said a bad word.

Mister Science: Sorry, little Johnny, but remember what Lenin said:
you cannot make an omelette without breaking heads!

Johnny: OK! I sure will! Thanks, Mister Science!
 
Reply With Quote
 
spinoza1111
Guest
Posts: n/a
 
      05-30-2010
On May 29, 9:18*pm, "osmium" <(E-Mail Removed)> wrote:
> "spinoza1111" wrote:
> > Hi, my name is Corazon Rosa Princess MacArthur Mirador de los Angeles,
> > and I am an IT and nursing student in Manila. My teacher uses the word
> > "stack". What does she mean?

>
> Well, princess, only your teacher knows what she means when she uses a word.
> Here are two possible meanings:
>
> o A stack, as in a stack of pancakes.
> o A woman, often young, with appealing mammary glands. Unfortunately, due to
> one warped old man (Hugh Hefner) and his impact on the culture, appealing is
> oftentimes equated to "large".


To vicious children who inherit the universal license and could not
live without it, all old men are by definition warped, since they've
killed the father without resolving the Oedipal crisis.

That's why they AP out of survey classes. The class might be taught by
a warped old man.

Besides, real men like enormous bazongas.
 
Reply With Quote
 
Chad
Guest
Posts: n/a
 
      05-30-2010
On May 30, 12:06*am, "io_x" <(E-Mail Removed)> wrote:
> a stack is a common array of memory where is defined the functions push()
> and pop() [and descrive what the functions do]
>


And what happens if someone changes the array to say a singly linked
list?
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      05-30-2010
Chad <(E-Mail Removed)> writes:
> On May 30, 12:06*am, "io_x" <(E-Mail Removed)> wrote:
>> a stack is a common array of memory where is defined the functions push()
>> and pop() [and descrive what the functions do]

>
> And what happens if someone changes the array to say a singly linked
> list?


I didn't respond to the original question because it was an obvious
troll, but I think you're actually trying to learn something, so ...

The term "stack" has two distinct but related meanings. (Actually it
has more than that, but only two are relevant here.)

In computer science terms, a stack is a data structure with last-in
first-out behavior. In other words, the available operations are
"push', which adds a new element to the stack, and "pop", which
removes the most recently added element (and either gives you its
value or discards it). The first element added to an empty stack
is at the "bottom" of the stack; the most recently added element
is at the "top".

There are a number of ways to implement a stack. One is as a
contiguous chunk of memory, an array, with an index variable that
indicates where the current "top" of the stack is (the bottom is
fixed and doesn't need an index variable). If the array is of a
fixed size, then the stack can only hold at most a fixed number of
elements; pushing an additional element causes an overflow error,
which must be handled somehow; conversely, if you use only a small
portion of the array, the rest is wasted. Another way to implement
a stack is as a linked list, which avoids the overflow and waste
problems (until you run out of memory), but is a bit more complex
and probably slower.

The other common meaning of "stack", usually referred to as "the
stack", is in computer systems architecture. It's a contiguous
region of memory where the index variable indicating the current
"top" of the stack is typically a CPU register, the stack pointer
(often called the "SP" register). Many systems use such a stack to
implement function calls: all the information needed for a function
call, including local data, possibly parameters, and housekeeping
data such as the return address, is pushed onto "the stack" when a
function is called, and popped when the function returns. The stack
may grow either up or down in memory, depending on the system.

Most current systems use this kind of stack, but not all do, and the
C standard doesn't refer to it at all. There are systems that use a
linked list of activation records, rather than a contiguous stack,
to manage function calls. There have been systems that don't use
any kind of stack for function calls; such systems cannot directly
support recursion, and therefore cannot support a C implementation.
Even on systems that do use a contiguous hardware stack, the details
vary from one system to another. Unless you're dealing with very
low-level details, you don't need to know about how the hardware
stack works to understand how a C program works.

I'm going into all this gory detail because some people in this
newsgroup have (perhaps deliberately) confused the two concepts,
and others have refused to acknowledge that a C implementation can
possibly use anything other than contiguous hardware stack.
Don't let them confuse you..

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments