delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f |
X-Recipient: | djgpp-workers AT delorie DOT com |
Message-ID: | <487E3A3A.3060909@iki.fi> |
Date: | Wed, 16 Jul 2008 21:13:14 +0300 |
From: | Andris Pavenis <andris DOT pavenis AT iki DOT fi> |
User-Agent: | Thunderbird 2.0.0.14 (X11/20080501) |
MIME-Version: | 1.0 |
To: | djgpp-workers AT delorie DOT com |
Subject: | Re: Fixes for strict aliasing warnings from GCC-4.3.1 |
References: | <487E2DD0 DOT 7080400 AT iki DOT fi> <200807161743 DOT m6GHhgeF026876 AT envy DOT delorie DOT com> |
In-Reply-To: | <200807161743.m6GHhgeF026876@envy.delorie.com> |
Reply-To: | djgpp-workers AT delorie DOT com |
DJ Delorie wrote: > We have a union-based trick we use for UNCONST, maybe that would be > cleaner to use than all those casts anyway? > > As a bonus, it would avoid the aliasing problems the "right way". > > #define unconst(__v, __t) __extension__ ({union { const __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;}) > > We could define a "as_long" that unions typeof(x) with long. I know. One can however use this typedef in macros like ones from include/ieeefp.h. It is not so nice with union trick. That is reason why I choosed this way. Andris
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |