Newsgroups: comp.lang.pascal Path: utzoo!utgpu!watserv1!watmath!dmurdoch From: dmurdoch@watmath.waterloo.edu (Duncan Murdoch) Subject: Re: Variable sized arrays? Message-ID: <1991Apr26.180056.9188@watmath.waterloo.edu> Organization: University of Waterloo References: <1991Apr21.211234.17738@ux1.cso.uiuc.edu> <1991Apr22.000227.26061@bnlux1.bnl.gov> <1991Apr23.022206.29766@ux1.cso.uiuc.edu> Date: Fri, 26 Apr 1991 18:00:56 GMT Lines: 33 There were a couple of misconceptions in earlier postings about trying to allocate contiguous blocks of size greater than 64K. 1. Why a limit of 65521 on Getmem allocations? This comes from the facts that, in versions 4.0 to 5.5, Getmem allocates the block at the very first place that it can find it, and all routines that use allocated blocks do 16 bit addressing only. If Getmem happens to allocate something at location 1234:000F, then the 65521st byte will be at address 1234:FFFF, and the 65522nd would wrap around to 1234:0000. In versions 4.0 to 5.5, the offset portion of an allocated address is always in the range 0000 to 000F, hence the limit. In version 6.0, the offset portion is always either 0000 or 0008, so presumably the limit is a bit bigger, but the manual doesn't mention it. Here you'll have to watch out for the fact that you might skip some bytes at the beginning to achieve the 8 byte granularity, but it should be a bit easier to get contiguous allocations. 2. Is a contiguous allocation good enough? The answer in all versions is no. Unless you do your own array addressing in assembler, inline, or pointer arithmetic, there's no way to get at anything after the address wraps around. You can't have an array bigger than 64K if you want to be able to use it as an array. Duncan Murdoch dmurdoch@watstat.waterloo.edu (when it's up :-)