Once upon a time, Akim Demaille wrote:
: Hi People,
:
: Does anybody sees a means to compute this at compile time? Using the
: same trick as we did for SIZEOF etc.
:
: The current test program is
:
: int
: main ()
: {
: /* Are we little or big endian? From Harbison&Steele. */
: union
: {
: long l;
: char c[sizeof (long)];
: } u;
: u.l = 1;
: exit (u.c[sizeof (long) - 1] == 1);
: }
:
: we rely on the exit to know the result.
[trh] p3d > uname -a
Linux trh.sim.no 2.0.36 #1 Tue Dec 29 13:11:13 EST 1998 i586 unknown
[trh] p3d > echo "0123456789" | od -x
0000000 3130 3332 3534 3736 3938 000a
[otto] larsa > uname -a
IRIX otto 6.5 01200533 IP32
[otto] larsa > echo "0123456789" | od -x
0000000 3031 3233 3435 3637 3839 0a00
Of course, this still doesn't do anything for the cross-compiling
problem (which is the real issue I guess), and I don't know if od
behaves consistently like this. Anyone?
Lars J