From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35247 invoked by alias); 17 Mar 2017 08:30:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 35230 invoked by uid 89); 17 Mar 2017 08:30:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-106.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:3351956, H*MI:sk:3351956, H*f:sk:3351956 X-HELO: drew.franken.de Received: from mail-n.franken.de (HELO drew.franken.de) (193.175.24.27) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Mar 2017 08:30:54 +0000 Received: from aqua.hirmke.de (aquarius.franken.de [193.175.24.89]) (Authenticated sender: aquarius) by mail-n.franken.de (Postfix) with ESMTPSA id 4C4DA721E280C for ; Fri, 17 Mar 2017 09:30:51 +0100 (CET) Received: from calimero.vinschen.de (calimero.vinschen.de [192.168.129.6]) by aqua.hirmke.de (Postfix) with ESMTP id 687655E03A9 for ; Fri, 17 Mar 2017 09:30:50 +0100 (CET) Received: by calimero.vinschen.de (Postfix, from userid 500) id 4FCC7A80EDA; Fri, 17 Mar 2017 09:30:50 +0100 (CET) Date: Fri, 17 Mar 2017 08:30:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: free() and implicit conversion to a function pointer Message-ID: <20170317083050.GD16777@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <58CB07A8.9010401@tlinx.org> <33519566-7f9a-ad78-6160-ccfa6465c279@t-online.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J5MfuwkIyy7RmF4Q" Content-Disposition: inline In-Reply-To: <33519566-7f9a-ad78-6160-ccfa6465c279@t-online.de> User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-03/txt/msg00185.txt.bz2 --J5MfuwkIyy7RmF4Q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1703 On Mar 17 00:49, Hans-Bernhard Br=C3=B6ker wrote: > Am 16.03.2017 um 22:46 schrieb L A Walsh: > > Going by subj and talk below, this is a bit confusing... > >=20 > > But it looks like you are testing 'free' for a value? >=20 > Not really. The idea is to test free for _exixtence_. Which only makes > sense in case of weak symbol support getting involved. In other situatio= ns, > there could not possibly be a need for a run-time if() test, because sure= ly > the code could know at build time whether free() exists or not. >=20 > > Isn't standard 'free' declared to take 1 arg and > > return void? >=20 > Yes. But since the code in question doesn't actually _call_ free, that's > both irrelevant. >=20 > > If you aren't talking standard 'free()', then > > nevermind... >=20 > We are talking standard free. More to the point, we're discussing newlib, > the package that actually implements free() for cygwin. >=20 > > > The only code that might actually be a slight bit better than the giv= en > > >=20 > > > if (! free) > > >=20 > > > would be > > >=20 > > > if (0 !=3D free) > > >=20 > > > The function designator `free' auto-decays into a function pointer, > > > which is compared to a null pointer constant: 0. The ! operator does > > > that same thing implicitly, but is fully equivalent to it. > > --- > > Free autodecays to a function pointer? >=20 > In the use case at hand: yes, it does. >=20 > > In what language? >=20 > Standard C. Wasn't that supposed to go to the newlib list where this has been discussed originally? Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --J5MfuwkIyy7RmF4Q Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYy566AAoJEPU2Bp2uRE+gsjUP+gJ3GgSjZGsHAAPDeDSJROKR Ia76LTbMTLM18M7O8vbtBHY4aQ8EXOzhQB2FPYIn7eYSYN8N7jvWzddybFeMRv8r PHNot1Ug+ZaRNKYdw6qOx0rjH4ZFcznu4IJwlYNZtvCObcih03feCnN606F0iGbN 2d+GX5P9vlQOOgSdQyNjiXHTInBL/dsE9iuHkbYL9UUufmdYpRy477ImxkF3pJ+p CFE/xsbBtEOqyZs5VC2nxiBRwbcPKZPJPc2muyRDvbAiGrgs4iIBg58PM7MteGix UcSur5RB9JpHrkHLRZJoZ1+ACok7xehZlHnvUFCwBWx7tRttKIaBqRoY20RyRlZd VfrDXYK4uyboN1E2IVz5JzB0rQc1ONs/oFoV301QbyzvT90GTn3rUplK4wwP1fpC CHJE0KOBep6/rUsaHoYsR8HYxAVaqHaPBmGka9TsWV01AFbMj7KYikxw/R68DGIT THS6zEYSTgvtpgnzOx8/cClVbXhUoUUVFKambvS3eanRuD/tJJVc6KO5f94xN8My B2y2mDPMgWKnFLTnBiY1d/k7I3SVuyUNCKYbbCBYP8O047cuDcLckAljE07jt52T NW7qTJsc0vmefGKCH3EomhiT1d1byhmGYtuznXlmiDfpMoVmckE4csJw2jWWPb27 HkclFDCynP0qe8xiOX1x =uzac -----END PGP SIGNATURE----- --J5MfuwkIyy7RmF4Q--