public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: newlib@sourceware.org
Subject: Re: Fwd: Re: free() and implicit conversion to a function pointer (was: Use of initialized variable in strtod.c)
Date: Mon, 20 Mar 2017 18:57:00 -0000	[thread overview]
Message-ID: <CAH8yC8mOynxCRa==j-bgvM0htd+rPxVE2N2rQARx4FBp+JhZBg@mail.gmail.com> (raw)
In-Reply-To: <f43b5494-513b-c5be-76a5-c7f81a69b9fa@redhat.com>

>> The reason this is wrong is that C by design treats data and functions
>> as living in separate realms, i.e. its virtual machine has a Harvard
>> architecture.  One of the consequences of this is that pointers to
>> functions and pointers to data are incommensurable, i.e. any and all
>> conversions or comparisons across this divide are wrong.  (void *) are
>> compatible to all data pointers, but not to function pointers.
>
> That's true of strict C99, but not true of POSIX (which adds the
> additional requirements above-and-beyond C99 that NULL be equivalent to
> ((void*)0) and that any function pointer can be converted to void* and
> back without loss of information, in part because of dlsym() and friends).
>
> Then again, not all newlib targets aim for POSIX compliance, and it is
> entirely feasible that someone is trying to use newlib to achieve C99
> compliance without caring about additional POSIX requirements.

+1. When I test for compatibility or ST&E, then I will test some
stated features even if I don't use them. -std=c99, -ansi and
_XOPEN_SOURCE are usually easy enough to test.

(Newlib confounds me at the moment, though. I have not figured out an
easy way to test it).

Jeff

      reply	other threads:[~2017-03-20 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f76885f4-f99f-dc50-2a19-cb892a62db7e@t-online.de>
2017-03-17 21:04 ` Hans-Bernhard Bröker
2017-03-20 18:45   ` Eric Blake
2017-03-20 18:57     ` Jeffrey Walton [this message]

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='CAH8yC8mOynxCRa==j-bgvM0htd+rPxVE2N2rQARx4FBp+JhZBg@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=eblake@redhat.com \
    --cc=newlib@sourceware.org \
    /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).