[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3

From: Chris Vine
Subject: Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3
Date: Sat, 8 Jun 2019 11:24:11 +0100

On Sat, 08 Jun 2019 11:46:10 +0200
Arne Babenhauserheide <address@hidden> wrote:
> Chris Vine <address@hidden> writes:
> > On Sat, 08 Jun 2019 10:07:45 +0200
> > Arne Babenhauserheide <address@hidden> 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."
> >> 
> >> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]