From: Chris Vine <vine35792468@gmail.com>
To: guile-devel@gnu.org
Subject: Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3
Date: Sat, 8 Jun 2019 11:24:11 +0100 [thread overview]
Message-ID: <20190608112411.6049eecb10610ec963324963@gmail.com> (raw)
In-Reply-To: <87a7eswgt9.fsf@web.de>
On Sat, 08 Jun 2019 11:46:10 +0200
Arne Babenhauserheide <arne_bab@web.de> wrote:
> Chris Vine <vine35792468@gmail.com> writes:
> > On Sat, 08 Jun 2019 10:07:45 +0200
> > Arne Babenhauserheide <arne_bab@web.de> wrote:
> > [snip]
> >> Wow, I didn’t know that you could do that.
> >>
> >> However: "The details of that allocation are implementation-defined, and
> >> it's undefined behavior to read from the member of the union that wasn't
> >> most recently written." https://en.cppreference.com/w/cpp/language/union
> >>
> >> Can you guarantee that this works?
> >
> > This is C and not C++ and the provision to which you refer does not
> > apply.
> >
> > Reading from a member of a union other than the one last written to is
> > implementation defined in C89/90, and defined in C99 (with Technical
> > Corrigendum 3) and above
>
> Thank you for the correction and explanation!
You have a good point though if visible type transformations were to
appear in a header rather than a *.c file, because guile headers are
(at the moment) intended to be in the common subset of C and C++ so that
libguile.h can be included in a C++ programme.
Having said that, gcc and clang support type punning through unions in
C++ as well as C. I don't know if guile is supposed to compile with
other compilers nowadays: but frankly it would be perverse for some
other compiler which supports both C and C++ to invoke different
behaviour for unions in such cases.
Chris
next prev parent reply other threads:[~2019-06-08 10:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 9:40 Immediate doubles (up to 2^256) and rationals coming to Guile 3 Mark H Weaver
2019-06-06 12:56 ` Mark H Weaver
2019-06-06 19:37 ` Arne Babenhauserheide
2019-06-12 0:03 ` Mark H Weaver
2019-06-06 20:09 ` tomas
2019-06-07 19:46 ` Ludovic Courtès
2019-06-09 16:56 ` Mark H Weaver
2019-06-09 17:30 ` Mark H Weaver
2019-06-11 8:39 ` Ludovic Courtès
2019-06-11 10:58 ` Mark H Weaver
2019-06-11 12:21 ` Ludovic Courtès
2019-06-11 11:34 ` Mark H Weaver
2019-06-08 1:13 ` Mark H Weaver
2019-06-08 8:07 ` Arne Babenhauserheide
2019-06-08 9:08 ` Chris Vine
2019-06-08 9:46 ` Arne Babenhauserheide
2019-06-08 10:24 ` Chris Vine [this message]
2019-06-08 13:12 ` Hans Åberg
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190608112411.6049eecb10610ec963324963@gmail.com \
--to=vine35792468@gmail.com \
--cc=guile-devel@gnu.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).