A
Axel F
Hi,
I have question about the following.
For instance I have a class like
class Cvec3
{
public:
float* begin() { return &x; }
operator float*() { return &x; }
public:
float x,y,z;
};
and I want to use c-function which take a pointer to float like some gl
functions. So I have defined the function begin(). I know this works and I
had never problems with this.
Somebody of my team says now, that it is not secure to do this, cause the
compiler can reorder the members x,y,z or can change pack alignment. He says
that nothing can be found about this in the c++ standard.
I hope somebody can help me to get the right arguments.
Thanks in advance,
Axel
I have question about the following.
For instance I have a class like
class Cvec3
{
public:
float* begin() { return &x; }
operator float*() { return &x; }
public:
float x,y,z;
};
and I want to use c-function which take a pointer to float like some gl
functions. So I have defined the function begin(). I know this works and I
had never problems with this.
Somebody of my team says now, that it is not secure to do this, cause the
compiler can reorder the members x,y,z or can change pack alignment. He says
that nothing can be found about this in the c++ standard.
I hope somebody can help me to get the right arguments.
Thanks in advance,
Axel