Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!ncar!elroy.jpl.nasa.gov!sdd.hp.com!think.com!masscomp!peora!tarpit!tous!alfred!fang!att!drutx!ldg@drywit.ATT.COM From: ldg@drywit.ATT.COM (XGPB30000-GibbonsD(DRR6702)262) Newsgroups: comp.sys.mac.programmer Subject: Re: malloc() in Think C programming on the Mac Message-ID: <7335@drutx.ATT.COM> Date: 24 Jan 91 21:44:07 GMT References: <1991Jan24.060336.12684@nlm.nih.gov> Sender: news@drutx.ATT.COM Reply-To: ldg@drywit.ATT.COM Distribution: comp Lines: 22 From article <1991Jan24.060336.12684@nlm.nih.gov>, by usenet@nlm.nih.gov (usenet news poster): > > Is there an idiosyncracy about malloc() in THink C on the Mac. > Is there an idiosyncracy about this on the Mac. > > I have code that compiles and runs under Unix and MSDOS. On the Mac, > it compiles without error and runs most of the time, however calls > to malloc(() which on the other operating systems return a pointer > and space reture null on the Macintosh (using the Think C console.h > and ANSI libraries). I have Think C 3.0, and I get caught by this one every time. Make sure the value you're passing to malloc() is an int (16 bits) and not a long. There is another routine (mlalloc ?) which takes a long. -- -------------------------------------------------------------------------------- -- Doug Gibbons | ldg@druhi.ATT.COM or att!druhi!ldg -- AT&T Bell Laboratories -- Denver CO