Possible Duplicate:
Why does ‘sizeof’ give wrong measurement?
I have a structure called CBUFFER_PEROBJECT:
struct CBUFFER_PEROBJECT
{
D3DXMATRIX Final;
D3DXMATRIX Rotation;
};
And in another class I do this:
...
bd.ByteWidth = sizeof(CBUFFER_PEROBJECT);
...
I found out that the size of D3DXMATRIX is 64, so 64+64 = 128 (right?). But my compiler is playing tricks with me (Visual C++), because as I was debugging the program, the bd.ByteWidth became 132, so I went to the Immediate Window (Visual Studio), and typed:
sizeof(D3DXMATRIX) + sizeof(D3DXMATRIX)
And the result was:
128
But the bd.ByteWidth became 132, and when I type the following into the "Immediate Window":
sizeof(CBUFFER_PEROBJECT)
It gives me:
128