guile-devel
[Top][All Lists]
Advanced

[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: Hans Åberg
Subject: Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3
Date: Sat, 8 Jun 2019 15:12:00 +0200

> On 8 Jun 2019, at 11:08, Chris Vine <address@hidden> wrote:
> 
> 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." 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, although it might include a trap
> representation (but wouldn't on any platform supported by guile).  You
> might want to see in particular footnote 95 of C11 (which isn't
> normative but is intended to explain the provisions of §6.2.6.1 which
> are).
> 
> gcc and clang have always supported type punning through unions.

FYI, the site mentioned above also covers C (there is a link the bottom of the 
C++ page above):
  https://en.cppreference.com/w/c/language/union





reply via email to

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