Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #21581

Re: Aliasing in C99

From Xavier Roche <xroche@free.fr.NOSPAM.invalid>
Newsgroups comp.lang.c
Subject Re: Aliasing in C99
Date 2012-05-31 16:53 +0200
Organization Nowhere Corp.
Message-ID <jq80l4$u8e$1@news.httrack.net> (permalink)
References <w5OdnYaSNZID5FrSnZ2dnUVZ8kqdnZ2d@lyse.net>

Show all headers | View raw


On 05/31/2012 04:01 PM, David Brown wrote:
> It is also possible to use pointers to unions in casts:

This would break strict aliasing, too. You probably need an intermediate 
union for that. Another way would be to only use union everywhere (on 
x86-64 ABI, it will be stored in a integer register when passed as 
argument to functions, so this won't make too much harm)

The unfortunate thing is that gcc, for example, will correctly handle 
the integer part, but tend to copy temporarily to the stack the 
register, and copy it back to the floating register. (gcc 4.3, Linux 
ABI, x86-64)

Note: you may want to check out this excellent introduction to strict 
aliasing here:
http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Aliasing in C99 David Brown <david.brown@hesbynett.no> - 2012-05-31 09:01 -0500
  Re: Aliasing in C99 James Kuyper <jameskuyper@verizon.net> - 2012-05-31 10:21 -0400
    Re: Aliasing in C99 David Brown <david.brown@hesbynett.no> - 2012-05-31 14:17 -0500
  Re: Aliasing in C99 Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-05-31 10:52 -0400
    Re: Aliasing in C99 Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-05-31 16:55 +0200
      Re: Aliasing in C99 Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-05-31 11:47 -0400
    Re: Aliasing in C99 Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 14:21 -0700
  Re: Aliasing in C99 Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-05-31 16:53 +0200
    Re: Aliasing in C99 David Brown <david.brown@hesbynett.no> - 2012-05-31 13:47 -0500
      Re: Aliasing in C99 Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-05-31 21:10 +0200
  Re: Aliasing in C99 Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 13:57 -0700
    Re: Aliasing in C99 David Brown <david.brown@hesbynett.no> - 2012-05-31 16:52 -0500
      Re: Aliasing in C99 Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 18:15 -0700
        Re: Aliasing in C99 David Brown <david@westcontrol.removethisbit.com> - 2012-06-01 09:52 +0200
          Re: Aliasing in C99 Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-01 09:07 -0700

csiph-web