🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Legal alloca?

#2601
From: Nick Maclaren
Date: Tue, 16 Apr 1996 01:05
28 lines
1642 bytes
In article <4kr7b2$kcb@solutions.solon.com>,
stanr@tiac.net (Stan Ryckman) wrote:
>
>Your example is too simple; that's an obvious conversion.
>Much more difficult is where alloca() has been used in a loop, to
>(for example) build a linked list (or worse) on the stack, and
>"return" has been used to free all the spaghetti.

Yes, quite.

If you want to see how hard it is to define semantics for alloca that
are tight enough to allow scope checking and flexible enough to allow
the creation of linked lists, look at the Algol 68 scoping rules.  It
is a foul problem, which is why alloca is not always provided.

>And, in answer to the original poster's question, yes, implementations
>without alloca() do exist; I had to port such spaghetti to one
>(some version of Venix) and it was a real mess.

Actually, there are far more mainstream systems without alloca, and
even HP-UX did not have it until recently.  Your point stands :-)


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679
Technical Details
Message-ID: <4kurpk$an7@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4klidc$ne8@solutions.solon.com> <4koe4u$8sl@solutions.solon.com> <4kr7b2$kcb@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Newsgroups: comp.lang.c.moderated
Subject: Re: Legal alloca?
Date: 15 Apr 1996 20:05:56 -0500
Organization: University of Cambridge, England
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4kurpk$an7@solutions.solon.com>
References: <4klidc$ne8@solutions.solon.com> <4koe4u$8sl@solutions.solon.com> <4kr7b2$kcb@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com