<div class="gmail_quote">On Fri, Jun 10, 2011 at 21:14, James Porter <span dir="ltr"><<a href="mailto:jvporter@wisc.edu">jvporter@wisc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":pc">That's not what your patch does, though. I think this sounds like a good<br>
idea in general (I missed the first email that explained the context),<br>
but I don't think "never allocate for 0-sized arrays" is the right way.<br></div></blockquote><div><br></div><div>Ah, but it is equivalent. If the user nullified the pointer, then by definition, they already have a pointer equal to NULL. That is valid to be passed to free(). If the user had a pointer that was non-NULL, then (according to our "new" semantics) they didn't want you to allocate anything.</div>
<div><br></div><div>I can't imagine a use case where the caller would depend on malloc(0) actually being called (given that either way, they have a pointer that can be free'd).</div></div>