Re: What Kind of DataStructures C using? ( Heap or Tree ??)
From: Michael Wojcik (mwojcik_at_newsguy.com)
Date: 10/08/04
- Next message: Dan Pop: "Re: When fopen() fails"
- Previous message: Eric Sosman: "Re: Catching a process' own stdout"
- In reply to: Eric Sosman: "Re: What Kind of DataStructures C using? ( Heap or Tree ??)"
- Next in thread: Dave Vandervies: "Re: What Kind of DataStructures C using? ( Heap or Tree ??)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Oct 2004 15:23:54 GMT
In article <ck683f$hu1$1@news1brm.Central.Sun.COM>, Eric Sosman <eric.sosman@sun.com> writes:
> John Cochran wrote:
> > In fact, not all computers have a stack (take at look at the
> > IBM 360/370/390 architecture). For those computers that don't have a stack,
> > the proper call/return nesting can be done by using a linked list of
> > blocks of memory where each block contains the linkage information to
> > handle the return as well as storage for local variables.
>
> Um, er, why doesn't the linked list you describe
> qualify as a "stack?" You can push things onto it and
> pop them off again in LIFO order -- that's a "stack" as
> far as I can see, even if it doesn't happen to use
> sequential allocation.
Sure, if you define "stack" as any data structure accessed in LIFO
order, then it's a stack. Many people, however, define "stack" as a
contiguous area with LIFO access in various contexts, and claiming
that C uses a stack is one of those. John's comment is perfectly
reasonable in that context.
A C implementation could use activation records and provide an
extension whereby they could be used in non-LIFO order (by adding
continuations to the language, for example). A program that did not
use that extension, and was entirely a conforming C program, would
still be using a C implementation that did not have a stack, even
though it happened to be using a data structure in a stack-like
manner.
-- Michael Wojcik michael.wojcik@microfocus.com Recently, they appeared at the reopening of the Brookdale Library, luring passersby with the opportunity to be anonymously silly.
- Next message: Dan Pop: "Re: When fopen() fails"
- Previous message: Eric Sosman: "Re: Catching a process' own stdout"
- In reply to: Eric Sosman: "Re: What Kind of DataStructures C using? ( Heap or Tree ??)"
- Next in thread: Dave Vandervies: "Re: What Kind of DataStructures C using? ( Heap or Tree ??)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|