This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [Question]:Can GCC report the size of all variables in C++ function?
- From: Justinas <jugu3479 at uosis dot mif dot vu dot lt>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 2 May 2004 10:00:23 +0300
- Subject: Re: [Question]:Can GCC report the size of all variables in C++ function?
- References: <20040502005322.M39384@mail.amss.ac.cn><20040502005543.M17236@mail.amss.ac.cn>
- Reply-to: Justinas <jugu3479 at uosis dot mif dot vu dot lt>
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