From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 65688389442C for ; Mon, 12 Apr 2021 06:13:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 65688389442C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-21sH-8xbORmSxFOqvoSEdA-1; Mon, 12 Apr 2021 02:13:24 -0400 X-MC-Unique: 21sH-8xbORmSxFOqvoSEdA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 126898026B1; Mon, 12 Apr 2021 06:13:23 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-148.ams2.redhat.com [10.36.112.148]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1087760C5F; Mon, 12 Apr 2021 06:13:21 +0000 (UTC) From: Florian Weimer To: Paul Zimmermann Cc: Paul Eggert , libc-alpha@sourceware.org Subject: Re: Fix REALLOC_ZERO_BYTES_FREES comment References: Date: Mon, 12 Apr 2021 08:13:31 +0200 In-Reply-To: (Paul Zimmermann's message of "Mon, 12 Apr 2021 08:05:16 +0200") Message-ID: <8735vwows4.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 06:13:27 -0000 * Paul Zimmermann: > Dear Paul, > >> From: Paul Eggert >> Date: Sun, 11 Apr 2021 14:42:22 -0700 >>=20 >> While looking into problems with glibc's documentation of=20 >> malloc/free/etc. I noticed that the comment for REALLOC_ZERO_BYTES_FREES= =20 >> was out of date: its reference to "the C standard" refers to ISO C11,=20 >> but that compatibility problem has been fixed in C17. I installed the=20 >> attached commentary fix as obvious. >>=20 >> [2:text/x-patch Show Save:0001-Fix-REALLOC_ZERO_BYTES_FREES-comment-to-m= atch-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 =E2=80=9CIf nonzero=E2=80= =9D clause=E2=80=94it's probably best to mention the REALLOC_ZERO_BYTES_FREES m= acro. And maybe also clarify that the range of permitted C17 behaviors goes beyond the two choices controlled by REALLOC_ZERO_BYTES_FREES. Thanks, Florian