David Woodhouse wrote:
On Wed, 2005-12-07 at 23:39 -0500, Bill Nottingham wrote:
2) Wordsize specific #defines and similar in a header file.
a) If they're just informational, remove them:
/* configured for i386-redhat-linux */
b) Abstract them out into separate files, or one
common file. For example, a file that has on i386:
#define LONG_SIZE 4
and on x86_64:
#define LONG_SIZE 8
could be changed to:
#ifdef __i386__
#include "bits/i386-defines.h"
#endif
#ifdef __x86_64__
#include "bits/x86_64-defines.h"
#endif
and the -defines.h files could be populated only on those arches.
OK, so I'm picking on your specific example... but a point which
probably needs making anyway...
The specific case above _shouldn't_ be changed like that; it should be
changed to sizeof(long) instead. If you can write portable code
_without_ the gratuitous ifdefs that autoconf(spit) encourages you to
abuse, then do so.
Things are not always that easy, LONG_SIZE as currently defined may be
used safely in preprocessor integer arithmetic, sizeof(long) == 0 as far
as the preprocessor is concerned.
Regards,
Hans