X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=iZgq7lVlUg0pSw7g TgUYESI9er3tHq44Bzk7ww493rDv1GqfVS6zPXcrnZRSepeN3HjEbwmc8CYnvHrN 5reSgJCMCV6Vq2zOBrujGg694sK6c3dCBHr7j4vdzGvjkY1tczZnqajPUAD7RKhr KDiShC5cTBvTAuquTzldJ7EpXeY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=jWu3PES4CA42Ip3VV/BTHX LKl1g=; b=USfM0qSoVHeLQ6G+TSWagP+x0vD4VwybNvuPGGLtRrNLwWdaoOiuPB yhTmLXuKvhfdvOkgItgxvpNP5ABjXvAQhdIFq3sRuhyw9pFCeqT3y3xOdfLQB4UN 4fjAUXXz6/6G9NdAwPKnI41GH6xn3fa4YxdexlYqqiS+lcN8cBxCs= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*M:online, H*F:D*t-online.de, walsh, Walsh X-HELO: mailout01.t-online.de Subject: Re: free() and implicit conversion to a function pointer To: cygwin AT cygwin DOT com References: <58CB07A8 DOT 9010401 AT tlinx DOT org> From: =?UTF-8?Q?Hans-Bernhard_Br=c3=b6ker?= Message-ID: <33519566-7f9a-ad78-6160-ccfa6465c279@t-online.de> Date: Fri, 17 Mar 2017 00:49:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <58CB07A8.9010401@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Am 16.03.2017 um 22:46 schrieb L A Walsh: > Going by subj and talk below, this is a bit confusing... > > But it looks like you are testing 'free' for a value? Not really. The idea is to test free for _exixtence_. Which only makes sense in case of weak symbol support getting involved. In other situations, there could not possibly be a need for a run-time if() test, because surely the code could know at build time whether free() exists or not. > Isn't standard 'free' declared to take 1 arg and > return void? Yes. But since the code in question doesn't actually _call_ free, that's both irrelevant. > If you aren't talking standard 'free()', then > nevermind... We are talking standard free. More to the point, we're discussing newlib, the package that actually implements free() for cygwin. >> The only code that might actually be a slight bit better than the given >> >> if (! free) >> >> would be >> >> if (0 != free) >> >> 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? In the use case at hand: yes, it does. > In what language? Standard C. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple