Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!purdue!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!babcock.cerc.wvu.wvnet.edu From: vrm@babcock.cerc.wvu.wvnet.edu (Vasile R. Montan) Newsgroups: comp.sys.mac.programmer Subject: Re: Variable length arrays in Pascal--can it be done? Message-ID: <1614@babcock.cerc.wvu.wvnet.edu> Date: 21 Apr 91 00:41:52 GMT References: <13102@goofy.Apple.COM> Sender: news@cerc.wvu.wvnet.edu Lines: 34 From article <13102@goofy.Apple.COM>, by mitch@Apple.COM (Mitchell Adler): [Deleted posting in which I ask whether you can SetHandleSize on an array as long as you're careful not to read/write past the end of the block] > Umm..not quite. Pascal is defined to Range Check at RUN time. That is, > if you access outside of the declared range it's a runtime error. So > as long as your dynamic array is smaller than your declared array, > you'd be OK for the range checking (assuming you don't write outside > the actual size of the array, as you said). But if you ever tried to > write to a location beyond the end of your declared size, you'd get a > runtime error. > > MPW Pascal (and I believe Think Pascal also), have the ability to turn off > runtime range checking. You'll need to turn it off everywhere you index > into your dynamic array. I've gone ahead and used the technique, but I am running into a problem of a different kind. I'd like to be able to define an array as, say, MyArrayType = array[0..32000] of SomeType, since 32000 is a lot bigger than I will ever need. Unfortunately, the Lightspeed Pascal Compiler (which is what I'm stuck with) gives it a thumbs-down and says "Variables of this type would be too large." It seems the biggest range possible is around [0..125], which may not be big enough for what I need. Don't some versions of Pascal allow you to declare a range as [0..0] to solve this problem? Lightspeed takes this to mean that your array has only one element, number 0, and gives a range error if you refer, say, number 1. So how do I turn off range checking in Lightspeed Pascal? Any ideas? --Kurisuto un020070@vaxa.wvnet.edu