G
Guest
CBFalconer said:... snip ... [un-snip start]David R Tribble wrote:
As a side issue, is an implementation allowed to return
the same value (besides NULL) for all malloc(0) calls? [un-snip end]
No; the spec says that at least one byte will be
actually allocated, and there is some general statement
that no two active heap allocations will overlap.No.
7.20.3 p1 (n1124 or N869)
If the size of the space requested is zero, the behavior is
implementation-defined: either a null pointer is returned, or the
behavior is as if the size were some nonzero value, except that
the returned pointer shall not be used to access an object.
Did you even read the previous message before responding?
Yes. You stated that at least one byte would be allocated. I
disputed that.
He stated that at least one byte would be allocated if the result is
not NULL, which is correct.