🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: malloc under Lattice C V5.05

#5402
From: Peter da Silva
Date: Sun, 23 Sep 1990 15:08
22 lines
1317 bytes
In article <1990Sep23.061925.6887@jato.jpl.nasa.gov> zupke@mars.UUCP (Brian Zupke) writes:
> In this case, the pointer mismatch can be eliminated by "casting" the 
> malloc function to type char.  For example:

> char *outname;

> outname = (char *)malloc(SomeConstant);

But the underlying problem, that malloc() is declared as returning an int
(by not being declared at all) still needs to be fixed. Try adding

	void *malloc();

somewhere in scope. You may still need to ast it, but at least your code
will still work when (int) and (void *) are no longer the same size.

(As an aside: most 68000 compilers I've used in the past have returned
 pointers in A0 and ints in D0. Seems like an obvious move. I guess Manx
 and Lattice had other priorities.)
-- 
Peter da Silva.   `-_-'
<peter@sugar.hackercorp.com>.
Technical Details
Message-ID: <6620@sugar.hackercorp.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!uunet!sugar!peter
References: <3034@orbit.cts.com> <V%$%LR_@rpi.edu> <1990Sep23.061925.6887@jato.jpl.nasa.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!uunet!sugar!peter
From: peter@sugar.hackercorp.com (Peter da Silva)
Newsgroups: comp.sys.amiga.tech
Subject: Re: malloc under Lattice C V5.05
Message-ID: <6620@sugar.hackercorp.com>
Date: 23 Sep 90 15:08:14 GMT
References: <3034@orbit.cts.com> <V%$%LR_@rpi.edu> <1990Sep23.061925.6887@jato.jpl.nasa.gov>
Reply-To: peter@sugar.hackercorp.com (Peter da Silva)
Organization: Sugar Land Unix - Houston
Lines: 22