This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

automated sizeof usage?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]