Article View: comp.std.c
Article #5113Re: The \c escape
From: Tony Luck
Date: Wed, 29 Jun 1988 10:16
Date: Wed, 29 Jun 1988 10:16
20 lines
1114 bytes
1114 bytes
In article <963@ficc.UUCP> peter@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
Technical Details
Message-ID:
<596@root44.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!stl!stc!root44!aeglReferences:
<4604@haddock.ISC.COM> <5907@umn-cs.cs.umn.edu> <8125@brl-smoke.ARPA> <8127@brl-smoke.ARPA> <963@ficc.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!stl!stc!root44!aegl From: aegl@root.co.uk (Tony Luck) Newsgroups: comp.std.c Subject: Re: The \c escape Message-ID: <596@root44.co.uk> Date: 29 Jun 88 10:16:46 GMT References: <4604@haddock.ISC.COM> <5907@umn-cs.cs.umn.edu> <8125@brl-smoke.ARPA> <8127@brl-smoke.ARPA> <963@ficc.UUCP> Reply-To: aegl@root44.UUCP (Tony Luck) Organization: UniSoft Ltd, London, England Lines: 20