What does malloc(0) return?

Alan J Rosenthal flaps at dgp.toronto.edu
Sun Jun 2 14:00:39 AEST 1991


bhoughto at hopi.intel.com (Blair P. Houghton) writes:
>But, the pointer, if it is returned, points to an address which is correctly
>aligned for _any_ object.  Whether this has any use I do not know.

It's presumably useful to be able to assign it to some pointer variable and be
able to test for equality.  If the pointer wasn't necessarily suitably aligned,
then two different ones might compare equal after being converted, say, to
pointers to struct blop.

ajr



More information about the Comp.std.c mailing list