The \c escape
Tony Luck
aegl at root.co.uk
Wed Jun 29 20:16:46 AEST 1988
In article <963 at ficc.UUCP> peter at ficc.UUCP (Peter da Silva) writes:
>
>(2) What's wrong with a readable and maintainable way of initialising a
> 32-bit unsigned integer to 0x464F524DL? You prefer that (or ('F'<<24)|
> ('O'<<16)|('R'<<8)|('M')) to 'FORM'?
But (as many people have already tried to point out) multi-character constants
aren't portable .... 'FORM' isn't necessarily 0x464F524DL e.g. on my machine
here (68030 based, i.e. big-endian) the following program:
main() { printf("0x%x\n", 'FORM'); }
produces as output:
0x4d524f46
Which in these days of portable data interchange, and networked systems is
likely to mess up your whole day.
Tony Luck
More information about the Comp.std.c
mailing list