RE: [LIP] alloc functions and stdlib...
"Sameer Oak" <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <[email protected]> |
Uday wrote: > When you include stdlib.h, it knows what you malloc function looks like and > reports no error (pointer to pointer conversion). It would also issue errors > if singnatures don't match. ... sameer oak writes: including stdlib.h is a good idea. but is it good enough over including malloc.h? i was particularly looking for this distinction between stdlib.h and malloc.h nothing is commented on malloc.h over stdlib.h. if stdlib.h is not included we need to type cast the return value of malloc(), calloc(), realloc(). if not type casted, the compiler generates a warning: warning: assignment makes pointer from integer without a cast. if included we don't need to type-cast since the compiler finds the signature in stdlib.h the same happens with malloc.h. if malloc.h is included, we don't need to type-cast the return value of malloc(), calloc(), and realloc() functions. does stdlib.h have any advantage over malloc.h - sameer oak. ********************************************************* Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click