Mac LightSpeed C question (elementary)

Ge Weijers ge at phoibos.UUCP
Tue Feb 14 00:50:58 AEST 1989


In article <1158 at naucse.UUCP>, rrw at 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 at cs.kun.nl



More information about the Comp.lang.c mailing list