🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2709

Re: Array Initialization

#2709
From: Michael Elizabeth Chastain
Date: Sat, 25 Nov 1995 08:51
34 lines
2260 bytes
In article <9532616.4242@mulga.cs.mu.OZ.AU>,
Fergus Henderson <fjh@munta.cs.mu.OZ.AU> wrote:
> But as you suggest below, on platforms for which stack allocation is
> difficult, the compiler could simply allocate such arrays on the heap.
> In any case, there is a very large variety of prior art in terms of
> language implementations that support variable length arrays on a variety
> of platforms.  For example, all Ada implementations support this.
> So does GNU C.

I accept the prior-art argument and the usefulness argument.

But I don't accept this part: 'the compiler could simply allocate such
arrays on the heap.'

The compiler may have to use a hidden auto-pointer-like mechanism for
removing such arrays from the heap in cases of function returns,
longjmp, and exceptions.  I expect this would be reasonable for function
returns and exceptions.  But it would be new functionality for
'longjmp'.

I say 'may have to' because every processor I know can implement
variable-sized stack frames by subtracting an appropriate value from
the stack pointer at the appropriate time.  But what about processors I
don't know about?  Are there truly any processors in use which don't
support subtracting a computed value from the stack pointer?

Michael Chastain
mec@duracef.shout.net
Check out my cool trace-and-replay debugger:
ftp://tsx-11.mit.edu/pub/linux/sources/usr.bin/mec-0.3.tar.gz
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <496gnn$hdh@treflan.shout.net>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <30B1CB7E.41C67EA6@ecid.cig.mot.com> <48t9t7$5c2@engnews1.eng.sun.com> <9532616.4242@mulga.cs.mu.OZ.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 25 Nov 95 08:51:40 GMT
Approved: fjh@cs.mu.oz.au
From: mec@treflan.shout.net (Michael Elizabeth Chastain)
Newsgroups: comp.std.c++
Subject: Re: Array Initialization
X-Original-Date: 25 Nov 1995 07:31:03 GMT
Organization: None
Message-ID: <496gnn$hdh@treflan.shout.net>
References: <30B1CB7E.41C67EA6@ecid.cig.mot.com> <48t9t7$5c2@engnews1.eng.sun.com> <9532616.4242@mulga.cs.mu.OZ.AU>
Reply-To: mec@duracef.shout.net
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMLbZN+EDnX0m9pzZAQGyZAGAj1mC4xWQQy0f7DhOZUvximkMVFiIqfyW
 vUKgILtzuveAOE1DNWkOu3YQRyUcG+9V
 =Fg6F