From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23837 invoked by alias); 12 Jun 2006 18:04:16 -0000 Received: (qmail 23815 invoked by uid 22791); 12 Jun 2006 18:04:14 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 12 Jun 2006 18:02:50 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Fpqjx-0002Ff-6O for gcc-help@gcc.gnu.org; Mon, 12 Jun 2006 20:02:17 +0200 Received: from vtab.com ([62.20.90.195]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Jun 2006 20:02:17 +0200 Received: from mattias by vtab.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Jun 2006 20:02:17 +0200 To: gcc-help@gcc.gnu.org From: =?iso-8859-1?q?Mattias_Engdeg=E5rd?= Subject: Re: How to type-pun and why Date: Mon, 12 Jun 2006 18:04:00 -0000 Message-ID: References: <17549.34528.458166.781477@dell.pink> User-Agent: nn/6.7.3 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00105.txt.bz2 Andrew Haley writes: >It's a gcc extension to ISO C. I only found "union casts" among the relevant extensions, but perhaps they imply that the union trick work? (I'm reluctant to use union casts as they are illegal outside gcc, but the "union trick" seems to be customary.) It is tempting to abbreviate the union trick by using pointers, like: double d = something; uint64_t x = ((union { double d; uint64_t x; } *)&d)->x; which _seems_ to work - but this is purely anecdotal evidence. Would this also be guaranteed by the same gcc extension?