public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* [Question]:Can GCC report the size of all variables in C++ function?
       [not found] <20040502005322.M39384@mail.amss.ac.cn>
@ 2004-05-02  1:08 ` Han Xinglou
  2004-05-02  7:03   ` Justinas
  0 siblings, 1 reply; 2+ messages in thread
From: Han Xinglou @ 2004-05-02  1:08 UTC (permalink / raw)
  To: gcc-help


All

I have the following on a GCC question ask for your help.

For example, we have the following code foo.C :

class A{
   int a;
   float b;
};

int main(){
  int var1;
  char var2;
  float var3;
  A  var4;

  return 0;
}

Can gcc provide a report to tell the size of all the variables in the 
subroutine above? For example, var1=4.

As you know, using
   gcc -fdump-translation-unit foo.C
we can get a foo.C.tu file which incluing many information about size, etc.
Can we get the information of the size of all the variables in foo.C.tu?
What does the items in foo.C.tu meant?

Do you have any advice on this problem? I could not find an proper option to
report the size of variables in GCC mannule.

Thank you very much for your kind help.
Best regards,

Xinglou Han

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Question]:Can GCC report the size of all variables in C++ function?
  2004-05-02  1:08 ` [Question]:Can GCC report the size of all variables in C++ function? Han Xinglou
@ 2004-05-02  7:03   ` Justinas
  0 siblings, 0 replies; 2+ messages in thread
From: Justinas @ 2004-05-02  7:03 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-02  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20040502005322.M39384@mail.amss.ac.cn>
2004-05-02  1:08 ` [Question]:Can GCC report the size of all variables in C++ function? Han Xinglou
2004-05-02  7:03   ` Justinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).