Xref: utzoo comp.sys.mac.programmer:4499 comp.lang.c:16260 Path: utzoo!attcan!uunet!mcvax!hp4nl!kunivv1!phoibos!ge From: ge@phoibos.UUCP (Ge Weijers) Newsgroups: comp.sys.mac.programmer,comp.lang.c Subject: Re: Mac LightSpeed C question (elementary) Summary: big arrays on mac Message-ID: <522@phoibos.UUCP> Date: 13 Feb 89 14:50:58 GMT References: <1158@naucse.UUCP> Organization: University of Nijmegen, The Netherlands. Lines: 40 In article <1158@naucse.UUCP>, rrw@naucse.UUCP (Robert Wier) writes: > There appears to be a 32k limit on data structures. Not too suprising > considering the limits of the 68k index register structure. I have > gotten around this problem in Pascal programs by doing allocate and > dispose operations. Is there something equivalent in C? Or is there > a more elegant technique (for example, on researcher here would like > to have a 512 * 512 array). The problem lies partly with the MC68000, and partly with the compiler writers. Some facts: 1) the mac system limit global data (variables) to 32K. 2) no such limit exists for malloc'ed storage. 3) the 68000 uses 16 bit offsets in indexed addressing 4) compiler writers can work around this quite easily. The LSC compiler is not a bad compiler, but in this resepect it could use some improvement. A 1000 x 1000 'matrix' is easily created: double *matrix[1000]; int i; for(i=0;i<1000;i++) matrix[i] = (double *)calloc(1000,sizeof(double)); this creates an object that is not equivalent to double matrix[1000][1000]; but can be accessed similarly. 'matrix' is an array of pointers that each point to an array of 1000 doubles Hope this helps. Ge' Weijers KUN Nijmegen, the Netherlands UUCP: ge@cs.kun.nl