avila@swinger.csd.sgi.com (Richard Avila) (06/19/91)
In pascal on the SGI box a user wanted to create an array type such that at compile time the bounds ( or size of the array ) is not known. Then at runtime the bounds can be assigned and the variable is created. In Ada this is call an unconstrained array. Does our Pascal have anything like this? Thnaks. -- Rick Avila Silicon Graphics Customer Support avila@csd.sgi.com
gaertner@tertius.in-berlin.de (06/20/91)
In article <1991Jun18.175558.1667@odin.corp.sgi.com>, avila@swinger.csd.sgi.com (Richard Avila) writes: > In pascal on the SGI box a user wanted to create > an array type such that at compile time the > bounds ( or size of the array ) is not known. > > Then at runtime the bounds can be assigned > and the variable is created. > The current Pascal definition allows only data types which must be known at runtime. There is a new Pascal standard (Extended Pascal) under development/revision (?) which allows the dynamic assignment of bounds (as I know). This Extended Pascal has been published by IEEE (sorry, I don't know the catalog number) and may be submitted to approval to ISO. The VAX Pascal implements a lot of the features of this Extended Pascal, so the following example has been taken from the VAX/VMS Pascal Language Reference Manual. It shows the usage of the so called `Schema Types': TYPE Array_Template(Upper_Bound : INTEGER ) = ARRAY[1..Upper_Bound] OF INTEGER ; VAR Array1 : Array_Template( 10 ) ; { ARRAY[1..10] OF INTEGER ; } Array2 : Array_Template( x ) ; { Upper bound determined at run-time by variable or function call ; } I hope that this Extended Pascal will be available on a lot of machines soon. Ralf --- Ralf Gaertner gaertner@venus.rz-berlin.mpg.de FHI Berlin
damm@diku.dk (Kristian Damm Jensen) (06/20/91)
avila@swinger.csd.sgi.com (Richard Avila) writes: >In pascal on the SGI box a user wanted to create >an array type such that at compile time the >bounds ( or size of the array ) is not known. >Then at runtime the bounds can be assigned >and the variable is created. >In Ada this is call an unconstrained array. >Does our Pascal have anything like this? No. Subject: Re: arrays Distribution: world References: <1991Jun18.175558.1667@odin.corp.sgi.com> avila@swinger.csd.sgi.com (Richard Avila) writes: >In pascal on the SGI box a user wanted to create >an array type such that at compile time the >bounds ( or size of the array ) is not known. >Then at runtime the bounds can be assigned >and the variable is created. >In Ada this is call an unconstrained array. >Does our Pascal have anything like this? No. You have to create this by yourself using pointers, since pointers are the only dynamic types in pascal. Mind you: I'm talking standard-Pascal. If you do not care about portability some compiler might support a like feature. -- Kristian Damm Jensen (damm@freja.diku.dk) "Life is like a sewer - what you get out of it depends on what you put into it" - Tom Lehrer
Kai_Henningsen@ms.maus.de (Kai Henningsen) (06/26/91)
gaertner @ tertius.in-berlin.de schrieb am Do 20.06.1991, 07:47 ga>There is a new Pascal standard (Extended Pascal) under development/revision (?) ga>which allows the dynamic assignment of bounds (as I know). This Extended ga>Pascal has been published by IEEE (sorry, I don't know the catalog number) ga>and may be submitted to approval to ISO. Well, IEEE is done with it. I have the standard: ANSI/IEEE 770X3.160-1989. Seems they submitted it to ISO/TC97/SC22/WG2. Anyway, IEEE approved Dec 6 89, ANSI approved Apr 10 90. I definitely like the result. Now, if I had a working compiler ... ga>I hope that this Extended Pascal will be available on a lot of machines soon. So do I! -- Kai Henningsen Internet: kh@ms.maus.de or kaih@math.uni-muenster.de Muenster UUCP: any_backbone_that_knows_domains!ms.maus.de!kh Germany Fido: kh%maus ms, 2:242/2.6 or Kai Henningsen, 2:242/2.244