How to write Trigraph like character sequences in a string (was:Re: to "OR" or not to "OR")
Norman Diamond
diamond at jit533.swstokyo.dec.com
Fri May 31 11:47:20 AEST 1991
In article <1157 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>In article <RICHARD.91May29092137 at lambda.iesd.auc.dk> richard at iesd.auc.dk (Richard Flamsholt S0rensen) writes:
>> puts("Too bad - it is impossible to use ??""! in a string :-)");
>puts("In fact, there is another impossible way to use ?\?! in a string :-)");
WARNING! NOT: >puts("and what about 1) \??!"); [as Mr. Weitzel said]
>puts(" 2) ?""?!");
>puts(" 3) ?""?""!");
>puts(" 4) ??\!");
>1) DOESN'T work (some books about ANSI-C are not aware of this
Uh, thank you, some books that falsely claim to be about ANSI-C...
Anyone care to name names, so that readers can be warned to avoid them?
>2) and 3) should work OK, [...] I'm not quite sure about 4)
It works.
I have seen recommendations for:
puts(" 5) ?\?!");
but maybe I like 4) better than 5). Furthermore, 4) and 5) work at
preprocessing time, when string concatenation has not been done yet.
Just to be perverse, here are two more:
puts(" 6) ???/?!");
puts(" 7) ????/!");
I lied; these are not just to be perverse. If you need trigraphs, then
you need these.
--
Norman Diamond diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Permission is granted to feel this signature, but not to look at it.
More information about the Comp.std.c
mailing list