PDA

View Full Version : Struct in VS 2008 compiler



nachovall
07-07-2011, 07:22 AM
Hi,

A cl_float4 type is defined in cl_platform.h as



typedef union
{
cl_float CL_ALIGNED(16) s[4];
#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y, z, w; };
__extension__ struct{ cl_float s0, s1, s2, s3; };
__extension__ struct{ cl_float2 lo, hi; };
#endif
#if defined( __CL_FLOAT2__)
__cl_float2 v2[2];
#endif
#if defined( __CL_FLOAT4__)
__cl_float4 v4;
#endif
}cl_float4;


The thing is that in Unix there is no problem to acces a cl_float4 as struct x,y,z or w since __GNU__ and not __STRICT_ANSI__ are defined.

With the VS 2008 compiler defines CL_ALIGNED(16) s[4] but not the extension struct so its only accessible by ,.s[0].s[1].s[2] or s[3].

Is there any compiler option or way so that I can access to a cl_float4 using x,y,z or w struct with Visual Studio?

Thanks