Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!cornell!rochester!bbn!uwmcsd1!ig!agate!violet.berkeley.edu!edmoy From: edmoy@violet.berkeley.edu (;;;;YF37) Newsgroups: comp.sys.mac Subject: Re: LSC, Mac limitations? Keywords: 32K limit, scanf, dynamic memory alloc. Message-ID: <6968@agate.BERKELEY.EDU> Date: 12 Feb 88 18:09:32 GMT References: <1161@hao.ucar.edu> Sender: usenet@agate.BERKELEY.EDU Reply-To: edmoy@violet.berkeley.edu.UUCP () Organization: University of California, Berkeley Lines: 36 In article <1161@hao.ucar.edu> bill@hao.ucar.edu (Bill Roberts) writes: >I have a number of questions which I hope folks out yonder can shine some light >on: >1) I'm trying to port over to the Mac, from a UNIX system (4.3bsd) a relatively >simple C program... >The problem is that the Mac apparently cannot handle any single >segment larger than 32K and my array of pointers, for a window that is >250 X 250pixels, is much larger than 32K (62500 to be exact.) Allocate the array at run time, using NewHandle() or NewPtr(). The size argument to both of these is a long. >2) Also, I have a line in the code like: > > stuff... > > while (sptr->next != NULL){ > ... > do some stuff; > }; > more stuff... >LSC acts as though it doesn't recognize the NULL (0L). Is it the case that I >have to explicitly set the last node's next pointer to 0L? If you are using malloc() to create the nodes, then it is not guaranteed that the structure will contain all zeros. Use calloc() to get a zero-filled structure. Even so, it is still good programming practice to assign all used structure elements to initial values (like NULL in this case). Edward Moy Workstation Software Support Group University of California Berkeley, CA 94720 edmoy@violet.Berkeley.EDU ucbvax!violet!edmoy