Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Manx bug? Keywords: calloc Message-ID: <77890@sun.uucp> Date: 16 Nov 88 19:14:53 GMT References: <7392@orstcs.CS.ORST.EDU> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Followup-To: comp.sys.amiga Organization: Sun Microsystems, Mountain View Lines: 22 In article <7392@orstcs.CS.ORST.EDU> (Erik J. Bennett) writes: >Why doesn't this work? > objectTable = (struct objectStruct *) > calloc((unsigned) 9000, 10); >It needs to allocate 90000 bytes. It doesn't. It allocate (90000-6553?) >bytes. I think this is an overflow error. You guessed it, 9000 * 10 == 90,000 which is greater than 32,767 or whatever 2^15-1 is. > My real question is, How do I get around this barrier? Several options, 1) Buy the Lattice compiler (:-)) 2) Compile with 32 bit ints specified and c32.lib 3) Switch it to a call to AllocMem(9000L * 10L, MEMF_CLEAR); just remember to call FreeMem(ptr, 9000L * 10L); before you exit. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.