Re: malloc(0) returns an invalid address

From: Richard Tobin <richard_at_inf.ed.ac.uk>
Date: Thu, 2 Dec 2004 11:30:17 +0000 (GMT)
> malloc() is required to return memory aligned for any fundamental C
> type regardless of the amount of memory allocated (i.e. malloc(1) isn't
> permitted to return an odd address on hardware where types larger than
> (char) must be aligned).

How could a conforming program tell the difference?

(And so, why isn't it legal under the as-if rule?)

-- Richard
Received on Thu Dec 02 2004 - 10:30:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:23 UTC