Hello,
i have a strange Problem which maybe MS specific.
Im am using VC++ 2005 Express Edition
I have defined a class like this:
1 2 3 4 5 6 7 8 9 10 11 12
|
class vec4
{
union
{
struct
{
float w,z,y,x;
};
__m128 reg;
float coord[4];
};
}
|
I am using intrinsic Methods like _mm_add_ps to define some operations.
In Project i have the settings:
C/C++ > Code Generation:
Enable enhanced construction set: Streaming SIMD Extensions (/arch:SSE)
Struct Member Alignment : 16 Bytes (/Zp16)
C/C++ > Optimization:
Enable intrinsic functions: yes (/Oi)
I think all the other Options are not interessting in this case.
Now I have another class -- lets say Foo
1 2 3 4 5 6 7
|
class Foo
{
public:
Foo( const vec4 & v = vec4(1,2,3) ) { myfoo = v; }
private
vec4 myfoo;
}
|
which is called in the Main Programm like this
Foo * afoo = new Foo();
at this call the programm crashed before the Constructor of Foo is entered.
Question - why?
Because i enabled the alignment settings in the project, i see now reason for this. May be the "new" is the Problem, because Foo is not aligned? But this is a guess :-)
Like to discuss about this Problem.