FidoNet Echomail Archive
aust_c_here

<<< Previous Index Next >>>

From: Paul Edwards
To: Frank Adam
Date: 1997-01-18 21:11:36
Subject: To cast or not to cast ?

FA> While looking at clues to why my program was chewing up memory, this 
FA> hit my eyes..

FA> From the borland technical manuals <ti738.asc>.
FA> "
FA> Failure to include ALLOC.H is a common mistake. When ALLOC.H is
FA> left out the type checking is not performed. Since there is no
FA> prototype the memory allocation functions are all thought by the
FA> compiler to be returning integer types. A program will usually
FA> continue to work without ALLOC.H in the near memory models, since
FA> an integer is the same size as the near pointers used in these
FA> memory models. However in the far memory models the segment half
FA> of the pointer is lost when the memory allocation function
FA> attempts to return a far pointer. These programs may or may not
FA> work. You should always include ALLOC.H.
FA> "

FA> Forget the last line, but..Does this say what i think it does ? 
FA> Just when i got used to not casting in C ?..

Yes, you should always have prototypes visible to your programs, if you do
not want the compiler to ASSUME what parameters you are passing, and what
you are returning.  Even if you are happy with the compiler assumption,
don't.  Always include function prototypes.  BFN.  Paul. 
@EOT:

---
 * Origin: X (3:711/934.9)