Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!samsung!ernie.viewlogic.com!m2c!umvlsi!dime!smectos!eli From: eli@smectos.gang.umass.edu (Eli Brandt) Newsgroups: comp.lang.pascal Subject: Re: Help: How can I implement a record with variable width Message-ID: <24882@dime.cs.umass.edu> Date: 9 Jan 91 19:59:09 GMT References: <29636@shamash.cdc.com> <11660@j.cc.purdue.edu> Sender: news@dime.cs.umass.edu Reply-To: eli@smectos.CS.UMASS.EDU (Eli Brandt) Organization: University of Massachusetts, Amherst Lines: 24 In article <11660@j.cc.purdue.edu> zhou@brazil.psych.purdue.edu (Albert Zhou) writes: >Pascal does not support variable length arrays. Actually, Pascal does, though TP doesn't implement it. There are two "levels" of Standard Pascal: 0 and 1. Level 1's only difference is that it supports variable- length arrays and is almost never implemented. As an unrecontructed C user, I do the following: type VarArrType = array[1..1] of integer; function UseVarArray(elements: integer; varr: VarArrType); var i: integer; begin for i := 1 to elements do writeln(varr[i]); end; with {$R-}, of course, and if you trash the OS doing this, well, be more careful. *Why* couldn't Borland make $PUSH and $POP compiler-flag-state directives? As it is, you when you want to make your final binary you have to go through the code killing the {$R-} code... {$R+} pairs. Or have your editor run your code through cpp before compiling, which does have its attendant benefits.