From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: free() and implicit conversion to a function pointer
Date: Fri, 17 Mar 2017 08:30:00 -0000 [thread overview]
Message-ID: <20170317083050.GD16777@calimero.vinschen.de> (raw)
In-Reply-To: <33519566-7f9a-ad78-6160-ccfa6465c279@t-online.de>
[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]
On Mar 17 00:49, Hans-Bernhard Bröker wrote:
> 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.
Wasn't that supposed to go to the newlib list where this has been
discussed originally?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-03-17 8:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c5af0608-17c4-2270-dbba-c3b704c9226e@t-online.de>
2017-03-16 19:25 ` free() and implicit conversion to a function pointer (was: Use of initialized variable in strtod.c) Hans-Bernhard Bröker
2017-03-16 21:46 ` free() and implicit conversion to a function pointer L A Walsh
2017-03-16 23:49 ` Hans-Bernhard Bröker
2017-03-17 8:30 ` Corinna Vinschen [this message]
2017-03-17 21:01 ` Hans-Bernhard Bröker
2017-03-20 18:43 ` Eric Blake
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=20170317083050.GD16777@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/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).