From: Florian Weimer <fweimer@redhat.com>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Cc: Paul Eggert <eggert@cs.ucla.edu>, libc-alpha@sourceware.org
Subject: Re: Fix REALLOC_ZERO_BYTES_FREES comment
Date: Mon, 12 Apr 2021 08:13:31 +0200 [thread overview]
Message-ID: <8735vwows4.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <mwk0p8t4v7.fsf@tomate.loria.fr> (Paul Zimmermann's message of "Mon, 12 Apr 2021 08:05:16 +0200")
* Paul Zimmermann:
> Dear Paul,
>
>> From: Paul Eggert <eggert@cs.ucla.edu>
>> Date: Sun, 11 Apr 2021 14:42:22 -0700
>>
>> While looking into problems with glibc's documentation of
>> malloc/free/etc. I noticed that the comment for REALLOC_ZERO_BYTES_FREES
>> was out of date: its reference to "the C standard" refers to ISO C11,
>> but that compatibility problem has been fixed in C17. I installed the
>> attached commentary fix as obvious.
>>
>> [2:text/x-patch Show Save:0001-Fix-REALLOC_ZERO_BYTES_FREES-comment-to-match-C17.patch (1kB)]
>
> you write "If nonzero, ... should free p .... Otherwise ... should do the
> equivalent of freeing p". Is there a difference between "free p" and "do the
> equivalent of freeing p"?
It's freeing p followed by malloc (0).
> Also "ISO C17 says the behavior is implementation-defined here": I guess you
> mean the "default value of REALLOC_ZERO_BYTES_FREES", since for me the
> behavior is what is described above.
This part I find confusing as well, and also the “If nonzero”
clause—it's probably best to mention the REALLOC_ZERO_BYTES_FREES macro.
And maybe also clarify that the range of permitted C17 behaviors goes
beyond the two choices controlled by REALLOC_ZERO_BYTES_FREES.
Thanks,
Florian
next prev parent reply other threads:[~2021-04-12 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 21:42 Paul Eggert
2021-04-12 6:05 ` Paul Zimmermann
2021-04-12 6:13 ` Florian Weimer [this message]
2021-04-12 6:19 ` Paul Zimmermann
2021-04-12 7:48 ` Paul Eggert
2021-04-12 7:53 ` Florian Weimer
2021-04-12 19:44 ` DJ Delorie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735vwows4.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=Paul.Zimmermann@inria.fr \
--cc=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).