CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (11/27/90)
From: "Brendan B. Boerner" <boerner@ut-emx.uucp> Newsgroups: comp.lang.pascal Subject: Re: (R)Re: Quick Directories/Better Sorts Message-ID: <40124@ut-emx.uucp> Date: 24 Nov 90 22:06:10 GMT To: info-pascal@BRL.MIL In article <40124@ut-emx.uucp> boerner@ut-emx.uucp (Brendan B. Boerner) writes: >In article <25082@adm.brl.mil> CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( >Karl Brendel) writes: >[...] >>Unfortunately, if >> >> Array[1..5000]of index >> >>gives "structure too large" (leading to the original message in this >>thread), then >> >> ^Array[1..5000]of index >> >>will also give "structure too large". 5000*SizeOf(Index) = 85000 bytes. >> >>You subsequently proposed a solution which _will_ work: the array of >>pointers (or pointer to an array of pointers). >[...] > >I disagree with Karl on the first point: the SizeOf a variable of >type ^array[1..5000] of index will be 4 (it's a pointer). Using >New(IndexPtrVar) will result in 85000 bytes being allocated on the >heap. [remainder deleted] Disagreement always encouraged. <smile> The SizeOf(^array...) isn't relevant to this example: the SizeOf(array...) is. You cannot allocate a single block of 85000 bytes on the Turbo Pascal heap. You should have tried to compile an example before compiling a reply. Try this one: type index = string[16]; iaptr = ^indexarray; ia = array[1..5000]of index; begin We don't need any more than that, because the result will be: Turbo Pascal Version 5.5 Copyright (c) 1983,89 Borland International TEST.PAS(4): Error 22: Structure too large. ia = array[1..5000]of index; ^ Cheers... +-------------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta, GA, USA | | ILink/RIME: KARL BRENDEL phone 404/639-2709 | | CIS : 73307,3101 fts 236-2709 | | GEnie: K.BRENDEL Home of Epi Info 5.0 | +-------------------------------------------------------------------------+