Article View: comp.std.c
Article #3083Re: How to write Trigraph like character sequences in a string (was:Re: to "OR" or not to "OR")
From: Norman Diamond
Date: Fri, 31 May 1991 01:47
Date: Fri, 31 May 1991 01:47
31 lines
2213 bytes
2213 bytes
In article <1157@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes:
>In article <RICHARD.91May29092137@lambda.iesd.auc.dk> richard@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@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.
Technical Details
Message-ID:
<1991May31.014720.2477@tkou02.enet.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!jit533!diamondReferences:
<1991May28.191122.15749@ncsu.edu> <1991May28.210421.9656@unlv.edu> <1991May28.231253.5226@csrd.uiuc.edu> <RICHARD.91May29092137 <1157@mwtech.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!jit533!diamond From: diamond@jit533.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: How to write Trigraph like character sequences in a string (was:Re: to "OR" or not to "OR") Message-ID: <1991May31.014720.2477@tkou02.enet.dec.com> Date: 31 May 91 01:47:20 GMT References: <1991May28.191122.15749@ncsu.edu> <1991May28.210421.9656@unlv.edu> <1991May28.231253.5226@csrd.uiuc.edu> <RICHARD.91May29092137 <1157@mwtech.UUCP> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 31