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
Mon Jun 3 11:15:39 AEST 1991


Attribution lost (Mr. Weizel, I think):
>>>puts("               4) ??\!");
>>>2) and 3) should work OK, [...] I'm not quite sure about 4)

My mistake:
>>It works.
[and another mixed pair, see below]

In article <1991May31.133330.1149 at roundup.crhc.uiuc.edu> steven at pacific.csl.uiuc.edu writes:
>(4) is not guaranteed to work because '\!' is not a valid ANSI escape.  The
>result of using '\!' (or any other invalid escape sequence) is undefined.

Right, sorry.  And my other mistake,
puts("               6) ????/!");
is not guaranteed to work either, but
puts("               7) ???/?!");
is.  And if you need trigraphs in the first place, then (7) is the ONLY
dependable way of obtaining the originally requested character sequence.
(Though again, string concatenation still works if you don't need the
two-question-marks-and-a-bang at preprocessing time.)
--
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