Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!jpd00964 From: jpd00964@uxa.cso.uiuc.edu Newsgroups: comp.sys.mac.programmer Subject: Re: malloc in LSC Message-ID: <227700042@uxa.cso.uiuc.edu> Date: 8 Sep 89 09:07:00 GMT References: <24@paperboy.OSF.ORG> Lines: 21 Nf-ID: #R:paperboy.OSF.ORG:24:uxa.cso.uiuc.edu:227700042:000:903 Nf-From: uxa.cso.uiuc.edu!jpd00964 Sep 8 04:07:00 1989 >/* Written 12:22 pm Aug 15, 1989 by lehotsky@pmax7.osf.org in uxa.cso.uiuc.edu:comp.sys.mac.programmer */ >/* ---------- "Re: malloc in LSC" ---------- */ > >Regarding malloc returning suspicious addresses.... > >I'm not a betting man, but I'd wager $0.50 (try and collect) >that you're calling malloc without having a proper prototype >for malloc declared. > >It's been a while since I have used LSC and done Mac programming, but >without the prototype, you're looking at register D0, not at register >A0 - which is where pointers are are returned. >/* End of text from uxa.cso.uiuc.edu:comp.sys.mac.programmer */ Worse, from personal experience, you are getting only 16 bits if you don't prototype it by including the correct .h files. That means that the high 8 bits (16bits on a Mac II) get zeroed. However, the original programmer should be calling NewPtr anyway, not malloc. Michael Rutman