Problems with malloc()

Karl Heuer karl at ima.isc.com
Thu Apr 4 12:44:05 AEST 1991


In article <1991Apr1.232358.18938 at milton.u.washington.edu> jinx at milton.u.washington.edu (Everyone Knows JINX) writes:
>Did you prototype your functions? If you didn't, you might have to
>explicitly cast msgalloc() to Message *.

This is incorrect advice.  If the (non-int) function isn't declared (whether
by prototype or by Classic C declaration is irrelevant), then the program is
wrong, and no amount of casting will make it right.  Non-int% functions *must*
be explicitly declared& before use.

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint
________
% Even int-valued functions *should* be, but for historical reasons the
  language doesn't require it.
& The best way to declare a function is to include the header file associated
  with it, if any.



More information about the Comp.lang.c mailing list