🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3771

runtime bounds on arrays

#3771
From: sam
Date: Tue, 25 Aug 1987 04:53
21 lines
1405 bytes
Can anyone out there tell me whether there is any form of dynamic arrays
in Modula-2?  Specifically, if it will only be known at run-time how large
a certain array needs to be (it is given as user input, or something), can
you do something like
     PROCEDURE p(N:CARDINAL);
       VAR x:ARRAY [0..N] OF  ...blah...
and simply pass the required size of x as the parameter to p?  I can find
nothing in Wirth or any other reference I can find saying that you cannot,
and the syntax allows it.  It seems like such a common situation that I
cannot imagine that the language would prevent me from doing it, yet the
compiler I have barfs when I try (admittedly it is an experimental
compiler).  So which is broken, the compiler or the language?

Thanks in advance for your help.

-- 
                              -Sam Weber

UUCP: {ihnp4 utzoo decwrl uw-beaver}!utcsri!sam
ARPA: sam@csri.toronto.edu
CSNET: sam@toronto
Technical Details
Message-ID: <5310@utcsri.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!utcsri!sam

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!utcsri!sam
From: sam@utcsri.UUCP
Newsgroups: comp.lang.modula2
Subject: runtime bounds on arrays
Message-ID: <5310@utcsri.UUCP>
Date: Tue, 25-Aug-87 00:53:09 EDT
Article-I.D.: utcsri.5310
Posted: Tue Aug 25 00:53:09 1987
Date-Received: Tue, 25-Aug-87 07:14:48 EDT
Reply-To: sam@utcsri.UUCP (Samuel Monk Weber)
Distribution: world
Organization: CSRI, University of Toronto
Lines: 21