C
Chris Fogelklou
Thanks for your pleasant and reasonable feedback ;-)
As I said, I always do this cast to make my code work. From firsthand
experience, I have in fact made the mistake of forgetting stdlib.h. At
least in my case, the compiler gives a "function with no prototype" warning
and the linker pukes. This is because the cast refers only to the return
value from the function, not the function itself (it must still resolve
malloc in order to cast its return value to something, right?). Even if it
did hide the compiler warning, wouldn't the build break because the linker
wouldn not be able to resolve the malloc label?
Thanks in advance!
Chris
PS: Disobeying my previous own advice to refer to the ANSI specs...
As I said, I always do this cast to make my code work. From firsthand
experience, I have in fact made the mistake of forgetting stdlib.h. At
least in my case, the compiler gives a "function with no prototype" warning
and the linker pukes. This is because the cast refers only to the return
value from the function, not the function itself (it must still resolve
malloc in order to cast its return value to something, right?). Even if it
did hide the compiler warning, wouldn't the build break because the linker
wouldn not be able to resolve the malloc label?
Thanks in advance!
Chris
PS: Disobeying my previous own advice to refer to the ANSI specs...