Re: incompatible implicit declaration of built-in function 'malloc'
Re: incompatible implicit declaration of built-in function 'malloc'
- Subject: Re: incompatible implicit declaration of built-in function 'malloc'
- From: "Clark Cox" <email@hidden>
- Date: Fri, 25 Aug 2006 16:17:16 -0400
On 8/25/06, Daniel R. Killoran,Ph.D. <email@hidden> wrote:
I get the following perplexing warning:
.../SeriatedSubs.c:159: warning: incompatible implicit declaration of
built-in function 'malloc'
on the perfectly ordinary-appearing line:
tPtr = tmpStr = (char *)malloc((size_t)leng/2+1);
In addition to the advice that you've gotten about #including
<stdlib.h>, I'll add this:
When writing C code *never cast the return value of malloc*. It serves
no useful purpose, and it can serve to hide errors (Though, in this
case, GCC seems smart enough to alert you to the problem despite the
cast; not all compilers will do that for you).
--
Clark S. Cox III
email@hidden
My CV/Resume:
http://homepage.mac.com/clarkcox3/files/Resume.pdf
http://homepage.mac.com/clarkcox3/files/Resume.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden