From owner-svn-src-all@FreeBSD.ORG Tue Jun 5 07:49:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2371D1065675; Tue, 5 Jun 2012 07:49:34 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id C2FCB8FC12; Tue, 5 Jun 2012 07:49:33 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 27352FE1; Tue, 5 Jun 2012 09:49:32 +0200 (CEST) Date: Tue, 5 Jun 2012 09:47:42 +0200 From: Pawel Jakub Dawidek To: "Andrey A. Chernov" Message-ID: <20120605074741.GA1391@garage.freebsd.pl> References: <201206042134.q54LYoVJ067685@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <201206042134.q54LYoVJ067685@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-arch@FreeBSD.org Subject: Re: svn commit: r236582 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 07:49:34 -0000 --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 04, 2012 at 09:34:49PM +0000, Andrey A. Chernov wrote: > Author: ache > Date: Mon Jun 4 21:34:49 2012 > New Revision: 236582 > URL: http://svn.freebsd.org/changeset/base/236582 >=20 > Log: > 1) IEEE Std 1003.1-2008, "errno" section, is explicit that > =20 > "The setting of errno after a successful call to a function is > unspecified unless the description of that function specifies that > errno shall not be modified." Very interesting. However free(3) is always successful. Maybe we need more context here, but the sentence above might talk about functions that can either succeed or fail and such functions do set errno on failure, but we don't know what they do to errno on success - they sometimes interact with the errno, free(3) never does. I aware that my interpretation might be too wishful, but it is pretty obvious to save errno value when calling a function that can eventually fail - when we save the errno we don't know if it will fail or not, so we have to do that, but requiring to save errno when calling a void function that can't fail is simply silly and complicates the code without a reason. > However, free() in IEEE Std 1003.1-2008 does not mention its interaction > with errno, so MAY modify it after successful call > (it depends on particular free() implementation, OS-specific, etc.). Expecting documentation to describe interaction with some global variable that it doesn't need is pretty silly too (ok, errno is special, but still). It make sense to describe all the cases when the function actually is sometimes using the global variable, but for a function that never fails and should never touch the global it doesn't make sense. Maybe that's why it doesn't mention interaction with errno? I agree that the standards aren't clear, but if saving errno around free(3) is the way to go, then I'm sure we have much more problems in our code, even if it is not suppose to be portable it should be correct - we never know who and when will take the code and port it. I guess what I'm trying to say here is that this is much bigger change than it looks and we should probably agree on some global rule here. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/NuZ0ACgkQForvXbEpPzSfyACeK8eSY42ZOt2Sl1X4SOxGXsdC WvIAoOFeogjkUqP7aMxtyL4lqO4yUNyp =sCiA -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP--