From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Hans_=C3=85berg?= Newsgroups: gmane.lisp.guile.devel Subject: Re: Immediate doubles (up to 2^256) and rationals coming to Guile 3 Date: Sat, 8 Jun 2019 15:12:00 +0200 Message-ID: <9BACFC2E-7449-45DF-92DA-76B7419A0737@telia.com> References: <87zhmvaw5p.fsf@netris.org> <877e9wc210.fsf@netris.org> <87blz8wlda.fsf@web.de> <20190608100825.7ae761680debe51e487913f1@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="61716"; mail-complaints-to="usenet@blaine.gmane.org" Cc: guile-devel@gnu.org To: Chris Vine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jun 08 15:12:35 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hZb98-000FvN-Ks for guile-devel@m.gmane.org; Sat, 08 Jun 2019 15:12:34 +0200 Original-Received: from localhost ([::1]:58398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZb97-0004Fi-8Q for guile-devel@m.gmane.org; Sat, 08 Jun 2019 09:12:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52991) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZb8i-0004Fb-Jy for guile-devel@gnu.org; Sat, 08 Jun 2019 09:12:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZb8h-0007d3-Ib for guile-devel@gnu.org; Sat, 08 Jun 2019 09:12:08 -0400 Original-Received: from v-smtpout1.han.skanova.net ([81.236.60.154]:42735) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZb8h-0007Zk-CR for guile-devel@gnu.org; Sat, 08 Jun 2019 09:12:07 -0400 Original-Received: from [10.0.1.8] ([90.227.203.185]) by cmsmtp with ESMTPA id Zb8bhkzoTpIpGZb8bh8nhy; Sat, 08 Jun 2019 15:12:01 +0200 In-Reply-To: <20190608100825.7ae761680debe51e487913f1@gmail.com> X-Mailer: Apple Mail (2.3445.104.11) X-CMAE-Envelope: MS4wfDAF5y02tqEfPgzu/CObSB/jw7285wa7eKFThrVHdaO1Bv1WcKOxGsuJl1KmUsRluOHMRj2yomsftpJxItl1/Ia8p2NCimOa69MlngAyl5Nd8HNGef+3 gW+WQ7xNuG2/Qpr+qkPJDY/Q/lDnUUOe3sROu5y/R5CT0C9W95Ipy/wAnPYpdwVYRc1iUlY8N0dkY/y+aO24aXKuDTcCrabt9vE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 81.236.60.154 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19957 Archived-At: > On 8 Jun 2019, at 11:08, Chris Vine wrote: >=20 > On Sat, 08 Jun 2019 10:07:45 +0200 > Arne Babenhauserheide wrote: > [snip] >> Wow, I didn=E2=80=99t know that you could do that. >>=20 >> 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 >>=20 >> Can you guarantee that this works? >=20 > This is C and not C++ and the provision to which you refer does not > apply. >=20 > 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 =C2=A76.2.6.1 = which > are). >=20 > 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