Re: How to know that stack is growing upward/downward?

From: Alex Fraser (me_at_privacy.net)
Date: 08/04/04


Date: Wed, 4 Aug 2004 13:35:26 +0100


"Keith Thompson" <kst-u@mib.org> wrote in message
news:lnu0vjhfn0.fsf@nuthaus.mib.org...
> In a listing, it's most common to show low addresses at the top:
>
> 0000 ...
> 0001 ...
> 0002 ...
> 0003 ...
>
> But this puts numerically higher addresses at a lower position in the
> listing.

FWIW, I have only ever seen stack direction illustrated against a memory
diagram, which I have only ever seen drawn with high addresses at the top.

> If you say the stack grows "upward", do you mean that it grows toward
> the top of the listing, or toward numerically higher addresses?

The listing is irrelevant to me (which I think explains my original post);
it's how the value of the stack pointer changes that defines the direction.

> Whichever one you mean, are you sure that someone else won't mean the
> opposite?

Hmm, I guess not. But I suspect the vast majority would mean as I described
above, don't you?

> > > Much better to use the terms "left to right" or "right to left".
> >
> > How does that help?
>
> 0000 ... 0001 ... 0002 ... 0003 ...
>
> Unless you're accustomed to a right-to-left language like Arabic or
> Hebrew, you're not likely to put high addresses on the left.

Right, that makes sense now.

Thanks,
Alex



Relevant Pages

  • Re: How to know that stack is growing upward/downward?
    ... >> But this puts numerically higher addresses at a lower position in the ... I have only ever seen stack direction illustrated against a memory ... >> the top of the listing, ... > it's how the value of the stack pointer changes that defines the direction. ...
    (comp.lang.c)
  • Re: How to know that stack is growing upward/downward?
    ... "Alex Fraser" writes: ... >> of memory mean. ... In a listing, it's most common to show low addresses at the top: ... But this puts numerically higher addresses at a lower position in the ...
    (comp.lang.c)