Article View: comp.lang.c.moderated
Article #2286Re: Bad Style Contest - We Have a Winner!
From: J. Kanze
Date: Thu, 14 Mar 1996 13:55
Date: Thu, 14 Mar 1996 13:55
58 lines
3143 bytes
3143 bytes
In article <4i6fo9$p28@solutions.solon.com>
schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz) writes:
|> James Kanze US/ESC 60/3/141 #40763 writes:
|> |> Konrad Schwarz writes:
|> |>
|> |> |> 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.
|> |>
|> |> IBM mainframes don't have stacks. Would you not consider them general
|> |> purpose CPU's? (While most modern architectures have stacks, I
|> |> suspect that if you looked at all of the general-purpose CPU's in
|> |> existance, you'd find more architectures without a stack than with.)
|> You're telling me that a C implementation on an IBM mainframe doesn't
|> use a register as a stack pointer or doesn't reserve a continuous
|> region of memory as a stack?
I don't know about how IBM does their implementations, but...
|> Note that you'd be hard pressed to find a RISC machine with a dedicated
|> stack pointer register.
|> |> |> How do you
|> |> |> implement C on machines that don't have a stack?
|> |>
|> |> The same way you implement any other language, I suppose. On the one
|> |> machine I have any experience with, local frames were allocated and
|> Is this the afore mentioned IBM mainframe? Was the language C---or
|> SIMULA :)?
The afore mentioned is an IBM mainframe compatible, and the language was
C. To be frank, it was a disasterous implementation of C, but that is
beside the question.
|> |> freed using a mechanism similar to malloc/free. Once allocated, the
|> |> size of the local frame could not be changed.
|> See my previous postings for how to implement alloca in this case.
I have heard that such implementations exist. I am simply pointing out
that the reason alloca is not in the standard is because such crazy
implementations asthe one I just described exist. (Even with a more
reasonable implementation of C on a 360's architecture, I can imagine
problems with alloca's of very large arrays, and perverse use of the
alloca function.)
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID:
<4i98gk$8na@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<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: kanze@gabi-soft.fr (J. Kanze) Newsgroups: comp.lang.c.moderated Subject: Re: Bad Style Contest - We Have a Winner! Date: 14 Mar 1996 07:55:32 -0600 Organization: GABI Software, Sarl. Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4i98gk$8na@solutions.solon.com> References: <4fjmdt$og4@solutions.solon.com> <4g27nn$qaj@solutions.solon.com> <4h2thl$1io@solutions.solon.com> <4hgc5l$99s@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com