Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!cornell!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.lang.misc Subject: Re: Dynamic array dimensioning Message-ID: <6847@june.cs.washington.edu> Date: 5 Jan 89 19:27:20 GMT References: <117400002@uxa.cso.uiuc.edu> Reply-To: pardo@cs.washington.edu (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 31 In article <117400002@uxa.cso.uiuc.edu> gsg0384@uxa.cso.uiuc.edu writes: >[What languages have run-time local array sizing?] >[Impossible to do in FORTRAN?] >[Is dynamic sizing too costly to implement?] Most of the ``very dynamic'' languages, e.g., Smalltalk have automatic dimension resizing. Others, such as Ada, Algol, Simula, and PL/1 have array size bound and procedure entry time. GNU cc also allows this as a nonstandard extension. [To the best of my knowledge] all standard FORTRANs must be able to run on a machine that has no dynamic memory allocation. Runtime size binding definitely requires memory allocation. Dynamic sizing is more expensive than static dimensioning for at least the following reasons: * The stack frame doesn't have a fixed size. Thus you need two registers dedicated to the call frame. Even if you don't care about using an extra register, you still have to load/reset them (time and code space). * Fewer array indexing optimizations are possible. Whether this is ``too expensive'' depends entirely on what you want. Hope this helps. ;-D on ( A dynamic kind of guy ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo