This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
automated sizeof usage?
- From: "Randy.Dunlap" <rddunlap at osdl dot org>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 4 Mar 2003 09:31:16 -0800
- Subject: automated sizeof usage?
- Organization: OSDL
Hi,
Is there an (automated) way to determine struct sizes...
without resorting to writing a dummy program that includes all
interesting structs and printing the sizeof each one of them?
I was wondering about something like this:
#ifdef WARN_SIZES
#warning szof struct v4l2_framebuffer: sizeof(struct v4l2_framebuffer)
#endif
but that just prints the literal string, i.e., it doesn't evaluate
the sizeof(...). Is there a way to evaluate and print that during
a compilation? Maybe #warning is done in a pass that is too early
to know the struct size. Is there a good way to do this?
Thanks,
--
~Randy