Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!sdcsvax!ucbvax!ENGVAX.SCG.HAC.COM!KVC From: KVC@ENGVAX.SCG.HAC.COM (Kevin Carosso) Newsgroups: comp.os.vms Subject: Re: Language question Message-ID: <8705230653.AA06889@ucbvax.Berkeley.EDU> Date: Fri, 22-May-87 15:21:00 EDT Article-I.D.: ucbvax.8705230653.AA06889 Posted: Fri May 22 15:21:00 1987 Date-Received: Sat, 23-May-87 19:02:02 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 35 > I'm a bit rusty in C and Pascal. Can anyone tell me if either of these > (or another HLL) allows the user to cast an array into an arbitrary type > at runtime and then read/write or otherwise manipulate it as such? Do I > have to use MACRO to do what I want? Thanks to all who reply. > -Ric Steinberger Through a non-standard extension, VAX Pascal allows type-casting. You could create a VAX Pascal routine that accepts the array and some indicator of the type and then operate on the elements of the array while casting them. For example, here's a simple Pascal program that treats an array as longwords or bytes... -------------------------------------------------------------- program z (input, output); type byte_array = array [0..7] of [byte] 0..255; long_array = array [0..1] of unsigned; var x : long_array := (1,2); i : integer; begin for i := 0 to 1 do writeln (x::long_array[i]); (* don't need the cast operator "::" here *) writeln; for i := 0 to 7 do writeln (x::byte_array[i]); end. -------------------------------------------------------------- /Kevin Carosso kvc%engvax@oberon.usc.edu Hughes Aicraft Co. kvc@engvax.scg.hac.com