Comments solicited re: quoted constants

Martin P. Ibert martini at heaven7.UUCP
Tue May 1 05:57:50 AEST 1990


In <16527 at haddock.ima.isc.com>, karl at haddock.ima.isc.com (Karl Heuer) writes:
>$ But I did invent a neat hack that avoids the problem in a fairly clean
>  manner:   switch (s[0]*'\1\0'+s[1]*'\0\1') { case 'xy': ... }   should work
>  with any sane implementation of SCCs, regardless of byte size and sex.

No, it shouldn't. Siamese character constants in itself are evil and non-
portable. (I'm sure my compiler barfs at them.) My advice: Forget it.
--
    __*__     | Martin P Ibert, Westendallee 100d, D-1000 Berlin 19, Germany
----|   |---- | Domain: martini at heaven7.uucp or martini%heaven7 at zelator.uucp  
============= | Bang path: ..!uunet!unido!tub!tmpmbx!zelator!heaven7!martini 
| | |   | | | | ------------------------------------------------------------
| | |   | | | | --- The lessons of Chernobyl have still not been learned ---



More information about the Comp.lang.c mailing list