'C' style etc...

David Collier-Brown daveb at geac.UUCP
Tue Apr 12 04:50:25 AEST 1988


| In article <8449 at agate.BERKELEY.EDU>, doug at eris.UUCP writes:
||			case 'REXX':
|  This is bad style...it is not guaranteed to work, according to K&R, and
|  certainly does *not* work with many C compilers.

In article <1813 at sugar.UUCP> peter at sugar.UUCP (Peter da Silva) writes:
| Whadda you know. Every compiler I've hit with this so far has worked just
| fine. I just assumed that it was in K&R. After all, it makes perfect sense,
| modulo byte ordering problems, so by the principle of least astonishment
| it should be there.

  Well, it works IFF you have 4-byte words, or a good promotion
mechanism to make 'REXX' turn into a long automagically (some do).
  It truncates on many 16-bit machines... including one old
pdp-11 I remember fondly.

  If you want something humorous, try using case `REXX` (notice the
quotes) on a machine using an old copy of PCC: It tries to generate
BCD for a GCOS 3 machine.

--dave (prior art, yes. yucko, though) c-b
-- 
 David Collier-Brown.                 {mnetor yunexus utgpu}!geac!daveb
 Geac Computers International Inc.,   |  Computer Science loses its
 350 Steelcase Road,Markham, Ontario, |  memory (if not its mind) 
 CANADA, L3R 1B3 (416) 475-0525 x3279 |  every 6 months.



More information about the Comp.lang.c mailing list