* automated sizeof usage?
@ 2003-03-04 17:40 Randy.Dunlap
2003-03-04 19:45 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Randy.Dunlap @ 2003-03-04 17:40 UTC (permalink / raw)
To: gcc
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: automated sizeof usage?
2003-03-04 17:40 automated sizeof usage? Randy.Dunlap
@ 2003-03-04 19:45 ` Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2003-03-04 19:45 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: gcc
On Mar 4, 2003, "Randy.Dunlap" <rddunlap@osdl.org> wrote:
> Is there an (automated) way to determine struct sizes...
You may want to have a look at autoconf 2.5x's AC_CHECK_SIZEOF macro
for inspiration.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-04 19:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 17:40 automated sizeof usage? Randy.Dunlap
2003-03-04 19:45 ` Alexandre Oliva
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).