Memory Fault

Karl Heuer karl at haddock.ima.isc.com
Mon Jul 23 08:46:16 AEST 1990


>if (buffer = (char *) malloc(strlen(string)) == NULL)

Henry has already pointed out the two bugs here; I'd like to note that, as
written, this code is assigning an integer expression to a pointer variable.
Shame on you for ignoring the compiler warning, or shame on the compiler for
silently accepting it.  (This isn't the VMS compiler again, is it?)

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list