I am getting conflicting results when I ask root and my C++ compiler (gcc 3.2.3) to evaluate the memory size of structs.
For example, the following trivial macro asks the C++ compiler to return the memory size of a “float” and of a simple struct called “Struct”:
#include <iostream>
struct Struct{
float one,two,three;
};
int main(){
cout<<"sizeof(float) = "<<sizeof(float)<<endl;
cout<<"sizeof(event) = "<<sizeof(Struct) <<endl;
}
When I run this macro using gcc, I get the following output:
sizeof(float) = 4
sizeof(event) = 12
However, when I run this same basic macro in root, I get:
sizeof(float) = 4
sizeof(event) = 16
Why does root seemingly add an extra 4 bytes onto the size of the same struct given that the struct is made up of only floats which both root and gcc agree upon the size of? Is there a way to make them agree? I am aware that root has its own system-independent variable classes (e.g. Int_t, Float_t, etc.). However, changing the code to utilize these classes still gives the same results.
Thank you,
Aaron