🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #10303

Re: Manx bug?

#10303
From: Chuck McManis
Date: Wed, 16 Nov 1988 19:14
22 lines
1316 bytes
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.
Technical Details
Message-ID: <77890@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!pepper!cmcmanis
References: <7392@orstcs.CS.ORST.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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