🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #43888

Re: Novice Programmer Question: Dynamic Memory Allocation under TC

#43888
From: Rich Siegel
Date: Thu, 14 Dec 1989 15:19
35 lines
1796 bytes
In article <1856@neoucom.UUCP> sam@neoucom.UUCP (Scott A. Mason) writes:
>Actually the fix may be very simple.  I had a similiar problem when porting
>some code from an (yuck) MeSsy-DOS program.
>I finally found out that Think C happily lets me compile a program with
>(x)alloc calls in it without the library included, but does strange things
>with the pointers allocated.

	This is a common problem when porting C code from systems where
sizeof(int) == sizeof(char *), because standard C assumes that a function
which is called before it is prototyped (or before its definition is
encountered) returns an int as its result. 

	In THINK C, libraries are added to the project; the #include
directive merely includes any necessary macros and prototypes.

If you don't wish to #include <storage.h>, you can insert a line like

char *malloc();

which will serve adequately as a prototype.

R.


~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"When someone who makes four hundred and fifty dollars an hour wants to
tell you something for free, it's a good idea to listen."

~~~~~~~~~~~~~~~
Technical Details
Message-ID: <3427@husc6.harvard.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!endor!siegel
References: <24770@cup.portal.com> <4196@sbcs.sunysb.edu> <1856@neoucom.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!endor!siegel
From: siegel@endor.harvard.edu (Rich Siegel)
Newsgroups: comp.sys.mac,comp.sys.mac.programmer
Subject: Re: Novice Programmer Question:  Dynamic Memory Allocation under TC
Message-ID: <3427@husc6.harvard.edu>
Date: 14 Dec 89 15:19:16 GMT
References: <24770@cup.portal.com> <4196@sbcs.sunysb.edu> <1856@neoucom.UUCP>
Sender: news@husc6.harvard.edu
Reply-To: siegel@endor.UUCP (Rich Siegel)
Distribution: usa
Organization: Symantec Language Products Group
Lines: 35