On Mon, 21 Feb 2005, Hrvoje Niksic wrote:

> > Besides, despite "sizeof(foo)" being a constant, you can't move a
> > comparison against it to cpp.
> 
> You can, Autoconf allows you to "check for size of foo", which gives
> you a SIZEOF_FOO preprocessor constant.  Then you can write things
> like:
> 
> #if SIZEOF_FOO == 4
>  /* Assume 32-bit foo */
> #else
>  /* Don't make that assumption */
> #endif

 This may work as a workaround for this particular case and may often be a 
reasonable choice regardless of the compiler's shortcoming.  But for some 
code it may be highly troublesome to maintain, especially if you get 
"sizeof(foo)" at both sides of an (in)equation.  It's hardly a gain to 
give up code readability to satisfy a picky compiler.

  Maciej

Reply via email to