This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] mtrace: properly handle realloc (p, 0)


On 01/02/2013 02:26 PM, Andreas Schwab wrote:
> POSIX.1-2008 says: "If size is 0 and ptr is not a null pointer, the
> object pointed to is freed."  That's pretty conclusive.

It's not conclusive, unfortunately, because it's possible to
interpret that section of POSIX.1-2008 as talking about only
what happens when realloc succeeds.

As I understand it Mr. Kosaki's point that the realloc spec
is likely to change in a future edition of POSIX, and that the new
realloc spec will likely invalidate glibc's current behavior.
Perhaps glibc will change then, or perhaps we'll decide that
the change would be more trouble than strict conformance would
be worth.

It's not clear to me whether it's worth future-proofing realloc's
callers now, in preparation for this possible future
incompatible change to glibc.   But it may be helpful to insert
a comment here explaining the situation, for the benefit of
future maintainers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]