This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Vector types and type conversions


On Wed, Apr 19, 2006 at 01:56:46PM -0700, Mark Mitchell wrote:
> Let's accept that both the bit-preserving and value-preserving
> conversions would be useful.  How do we differentiate the two?
> 
> In C++, we could invent __value_cast<T> and __bitwise_cast<T>.  For
> example, __bitwise_cast<int>(3.0f) would be defined as equivalent to:
> 
>   ({
>      union {
>       int i;
>       float f;
>      } temp;
>      temp.f = 3.0f;
>      temp.i;
>    })

Those concepts roughly correspond to the existing static_cast and
reinterpret_cast.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]