[Question]:Can GCC report the size of all variables in C++ function?
Justinas
jugu3479@uosis.mif.vu.lt
Sun May 2 07:03:00 GMT 2004
laba Han,
Sunday, May 2, 2004, 3:55:43 AM, man parasei:
HX> All
HX> I have the following on a GCC question ask for your help.
HX> For example, we have the following code foo.C :
HX> class A{
HX> int a;
HX> float b;
HX> };
HX> int main(){
HX> int var1;
HX> char var2;
HX> float var3;
HX> A var4;
HX> return 0;
HX> }
HX> Can gcc provide a report to tell the size of all the variables in the
HX> subroutine above? For example, var1=4.
HX> As you know, using
HX> gcc -fdump-translation-unit foo.C
HX> we can get a foo.C.tu file which incluing many information about size, etc.
HX> Can we get the information of the size of all the variables in foo.C.tu?
HX> What does the items in foo.C.tu meant?
HX> Do you have any advice on this problem? I could not find an proper option to
HX> report the size of variables in GCC mannule.
HX> Thank you very much for your kind help.
HX> Best regards,
HX> Xinglou Han
Hello Xinglou Han,
try to use sizeof() !
Justinas
More information about the Gcc-help
mailing list