Pat Lashley <[EMAIL PROTECTED]> writes: > BUT, that said, the safest and most portable coding practice would be: > > // The C standard does not require malloc(0) to return NULL; > // but whatever it returns MUST NOT be dereferenced. > ptr = ( size == 0 ) ? NULL : malloc( size ) ;
Safest (avoiding null derefence) would instead be: ptr = malloc(size ? size : 1); BTW: // is not a valid C89 comment, but a GCC-ism. -- Matthias Andree _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"