🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6095

Re: Dynamic array dimensioning

#6095
From: Barry Margolin
Date: Thu, 05 Jan 1989 16:44
32 lines
1362 bytes
PL/I allows automatic arrays to be sized dynamically.  The size of an
array can be any expression using variables from a containing lexical
context; for example, you can do:

	declare array_size fixed binary;

	array_size = compute_size();
	begin;
	     declare array (array_size) fixed binary (8);
	     ...
	end;

But you couldn't do this if array and array_size were declared in the
same block.  The one exception to this is arrays in the top-level
block of a procedure, which may be dimensioned using its parameter
variables, e.g.

	my_proc: procedure (array_size);
	     declare array_size fixed binary parameter;
             declare array (array_size) fixed binary (8);
             ...
	end my_proc;

In general, the rule is that the array dimension must be computable
before any local variables are initialized.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID: <35163@think.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!ima!think!barmar
References: <117400002@uxa.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!ima!think!barmar
From: barmar@think.COM (Barry Margolin)
Newsgroups: comp.lang.misc
Subject: Re: Dynamic array dimensioning
Message-ID: <35163@think.UUCP>
Date: 5 Jan 89 16:44:31 GMT
References: <117400002@uxa.cso.uiuc.edu>
Sender: news@think.UUCP
Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin)
Organization: Thinking Machines Corporation, Cambridge MA, USA
Lines: 32