Mac LightSpeed C question (elementary)

Stephen Uitti suitti at haddock.ima.isc.com
Tue Feb 14 04:02:52 AEST 1989


In article <1158 at naucse.UUCP=> rrw at naucse.UUCP (Robert Wier) writes:
=>... LightSpeed C:
=>
=> There appears to be a 32k limit on data structures.  I have
=> gotten around this problem in Pascal programs by doing allocate and
=> dispose operations.  Is there something equivalent in C?
	mlalloc().  One would normally use malloc(), but malloc
historically takes an "int" - which is 16 bits in LSC.  mlalloc()
takes a long.  I have written stuff with 300KB arrays in LSC.  It can
be a little tricky debugging it, due to memory (or lack thereof)
problems.  Many people use the Mac OS calls to do memory stuff.  I try
to use standard C where I can.  I've always thought of malloc() as
part of the language.  PC's solve this with farmalloc() - sigh.  I
vaguely recall having to declare void *mlalloc(); so that the cast
would work right.

=> Or is there
=> a more elegant technique (for example, on researcher here would like
=> to have a 512 * 512 array).  
	Maybe something like:
	foo = mlalloc(sizeof(int[512][512]));
	if (foo == NULL)
		abort();	/* or whatever, but check! */
	foo[30][25] = 6;

=> Not being a C programmer, I would appreciate an answer in words of
=> one syallable :-).  
=> -Bob Wier
	Sorry, mlalloc() has more than that.  The manual describes it,
though.  Watch for include files, libraries, etc.  Always use prototypes.
	Stephen.



More information about the Comp.lang.c mailing list