Tim,
On 2004 Jul 13 , at 20.54, Tim Jenness wrote:
> Quick comment: If WORDS_BIGENDIAN is meant to be a boolean shouldn't
> the
> fpp code be written like this:
>
> #if !WORDS_BIGENDIAN
>
> ...
>
> #endif
>
> rather than
>
> #if WORDS_BIGENDIAN == 0
>
> ...
>
> #endif
>
> Or is it really meant to always be defined and have explicit values of
> 1
> or 0? [I am asking for clarification here, not implying a mistake - I
> did
> this in GSD using the first technique]
It doesn't really matter which one you use, though I think
#if WORDS_BIGENDIAN
...
#else
...
#endif
is neatest.
All of the autoconf defines are either defined to be 1 or are left
_un_defined -- that is, not defined to 0. This looks rather
unexpected, and suggests that the test should be something like "#if
defined(BLAH) && BLAH == 1", but it's unnecessary.
In preprocessor #if lines:
> After all replacements due to macro expansion and the defined unary
> operator have been performed, all remaining identifiers are replaced
> with the pp-number 0, and then each preprocessing token is converted
> into a token (9899: 6.10.1, para 3)
That is, any unknown/undefined identifiers are effectively 0/false.
Norman
--
----------------------------------------------------------------------
Norman Gray : Physics & Astronomy, Glasgow University, UK
http://www.astro.gla.ac.uk/users/norman/ : www.starlink.ac.uk
|