🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2232

Re: Bad Style Contest - We Have a Winner!

#2232
From: Thad Smith
Date: Mon, 11 Mar 1996 12:28
32 lines
2050 bytes
In article <4hv05f$j9i@solutions.solon.com>,
schwarz@a2.complang.tuwien.ac.at (Konrad Schwarz) wrote:
>In article <4hqed0$1lc@solutions.solon.com>, kanze@gabi-soft.fr (J. Kanze) writes:
>|>     [Concerning alloca...]
>I: As far as I know, implementing alloca via the stack is trivial on
>I: any general-purpose CPU, but I am interested in hearing of counter examples.
>|> 
>|> So what do you do on machines that don't have a stack?
>
>General-purpose CPU's have stacks, at least in my book.  How do you
>implement C on machines that don't have a stack?

I am currently using such a beast for embedded firmware development on
an Intel 8051, which has a very small stack.  Allocation of auto
variables is done in two ways:

1.  A software stack in external memory is allocated for functions
that are explicitly reentrant.  This is the exception because of the
overhead required to manage and use the software stack.

2.  Fixed memory areas are allocated for non-reentrant functions.  The
loader generates the calling tree and figures out what functions are
never active concurrently.  Those functions can be allocated the same
area in memory.

Because the default is non-reentrant and a declaration is required for
reentrant functions, it isn't fully conforming.  Also, the linker
needs some additional information when function pointers are used to
know who calls whom.  In general, it seems to be a good adaptation of
C to the limited resources of the target processor.

Thad
Technical Details
Message-ID: <4i168k$g2@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4fjmdt$og4@solutions.solon.com> <4g27nn$qaj@solutions.solon.com> <4h2thl$1io@solutions.solon.com> <4hgc5l$99s@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: thads@csn.net (Thad Smith)
Newsgroups: comp.lang.c.moderated
Subject: Re: Bad Style Contest - We Have a Winner!
Date: 11 Mar 1996 06:28:04 -0600
Organization: T3 Systems
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4i168k$g2@solutions.solon.com>
References: <4fjmdt$og4@solutions.solon.com> <4g27nn$qaj@solutions.solon.com>
 <4h2thl$1io@solutions.solon.com> <4hgc5l$99s@solutions.solon.com>
Reply-To: ThadSmith@acm.org
NNTP-Posting-Host: solutions.solon.com