Topic: trigraphs in current Draft
Author: James Kanze <james-albert.kanze@vx.cit.alcatel.fr>
Date: 1997/03/05 Raw View
d96-mst@nada.kth.se (Mikael Steldal) writes:
|> In article <slrn5h40ph.jut.juhni@kianto.suomussalmi.fi>,
|> juhni@kianto.suomussalmi.fi (Juha Niskanen) wrote:
|>
|> >Another idea. Why not mark trigraphs, digraphs, and <ciso646> deprecated,
|>
|> Please don't mark the new keywords (and, or, etc.) deprecated, they are
|> nice even if you have a decent console. But I'll agree that trigraphs
|> should be deprected, I don't think anyone would use them unless they have
|> to.
That's for sure. The problem is, some people have to.
--
James Kanze home: kanze@gabi-soft.fr +33 (0)1 39 55 85 62
office: kanze@vx.cit.alcatel.fr +33 (0)1 69 63 14 54
GABI Software, Sarl., 22 rue Jacques-Lemercier, F-78000 Versailles France
-- Conseils en informatique industrielle --
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: Ted Clancy <s341282@student.uq.edu.au>
Date: 1997/03/06 Raw View
James Kanze wrote:
>
> |> >Another idea. Why not mark trigraphs, digraphs, and <ciso646> deprecated,
> |>
> |> Please don't mark the new keywords (and, or, etc.) deprecated, they are
> |> nice even if you have a decent console. But I'll agree that trigraphs
> |> should be deprected, I don't think anyone would use them unless they have
> |> to.
>
> That's for sure. The problem is, some people have to.
>
I haven't had any experience working with trigraphs (living in an
English-speaking country), but from what I understand, trigraphs are
only still necessary in string and character literals. (In other places
we can use the new digraphs.)
e.g.
While z=x^y; can become z=x xor y;
string s="Press ^K"
would have to be
string s="Press ??'K";
Couldn't we define a standard header containing
#define CARET ^
#define S_CARET "^"
#define C_CARET '^'
#define BAR |
#define S_BAR "|"
#define C_BAR '|'
<etc., for all nine trigraphs>
So then we could write
string s="Press " S_CARET "K";
Which would expand to
string s="Press " "^" "K";
(which would be treated as one string by the compiler)
and make trigraphs redundant.
As much as I don't like essential parts of the language to rely on
MACROs, I think this would be a temporary measure, and more readable
than trigraphs.
--
Ted Clancy | "...This is Pauline Hanson of Borg
s341282@student.uq.edu.au | Resistance is futile
BE/BA, University of Queensland. | You _will_ be assimilated..."
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: d96-mst@nada.kth.se (Mikael Steldal)
Date: 1997/03/02 Raw View
In article <slrn5h40ph.jut.juhni@kianto.suomussalmi.fi>,
juhni@kianto.suomussalmi.fi (Juha Niskanen) wrote:
>Another idea. Why not mark trigraphs, digraphs, and <ciso646> deprecated,
Please don't mark the new keywords (and, or, etc.) deprecated, they are
nice even if you have a decent console. But I'll agree that trigraphs
should be deprected, I don't think anyone would use them unless they have
to.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: b91926@fsui02.fnal.gov (David Sachs)
Date: 1997/02/26 Raw View
This question about trigraphs appears in my comments about the
C++ standard.
I think that at one time there was a C compiler that replaced 3
consecutive question marks with a single question mark as part
of trigraph processing, and that the example in question is a
relic.
Somebody may have felt that this substitution was needed in order
to build string literals that look like trigraphs. Current C and
C++ compilers provide alternative ways to do this.
--
** The Klingons' favorite food was named by the first earthling to see it **
David Sachs - Fermilab, MSSG MS369 - P. O. Box 500 - Batavia, IL 60510
Voice: 1 630 840 3942 Department Fax: 1 630 840 3785
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: David R Tribble <david.tribble@central.beasys.com>
Date: 1997/02/27 Raw View
The example given in the C++ CD2 is wrong (assuming that ANSI C++ intends to
borrow the same trigraph lexicon from ANSI C).
Its current form in the CD2 is [p.2-3]:
2.3 Trigraph sequences
...
4 Trigraph replacement is done left to right, so that when two sequences
overlap, only the first sequence is replaced. Characters that result
from trigraph replacement are never part of a subsequent trigraph.
[Example: The sequence "???=" becomes "?=", not "?#". The sequence
"?????????" becomes "???", not "?". -end example]
---
For comparison, I quote from ANSI/ISO 9899-1990 (Standard C) [p.11]:
5.2.1.1 Trigraph sequences
All occurrences in a source file of the following sequences of three
characters (called 'trigraph sequences') are replaced with the
corresponding single character.
??= #
??( [
??/ \
??) ]
??' ^
??< {
??! |
??> }
??- ~
No other trigraph sequences exist. Each '?' that does not begin one of
the sequences listed above is not changed.
Example
The following source line
printf("Eh???/n");
becomes (after replacement of the trigraph sequence '??/')
printf("Eh?\n");
---
The list of valid trigraphs is the same in both the CD2 and ANSI C. Notice
that trigraph '???' is not in either list. Also notice in the C example that
'???' does not begin a valid trigraph sequence, so the initial '?' is left
alone (but the '??/' is a valid trigraph sequence and is replaced with '\').
CD2 paragraph 4 is redundant; since '?' cannot be the result of a trigraph
substitution, it is impossible that "characters that result from a trigraph
replacement are part of a subsequent trigraph."
The example in the CD2 should be restated like the one in ANSI C.
-- David R. Tribble, david.tribble@central.beasys.com --
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: juhni@kianto.suomussalmi.fi (Juha Niskanen)
Date: 1997/02/24 Raw View
Can someone please explain me what is the purpose and interpretation of t=
his=20
subclause? (Under 2.3 Trigraph sequences in December 2 Draft)
3 [Note: no other trigraph sequence exists. Each ? that does not begin o=
ne of the=20
trigraphs listed above is not changed. ]
4 Trigraph replacement is done left to right, so that when two sequences=
which could
represent trigraphs overlap, only the first sequence is replaced. Charac=
ters that=20
result from trigraph replacement are never part of a subsequent trigraph=
. [Example:=20
The sequence "???=3D" becomes "?=3D", not "?#". The sequence "?????????"=
becomes "???",=20
not "?". =D0end example]
If I interpret this correctly, ??? is always replaced by ?, even ??? is n=
ot a trigraph. However
this contradicts with the note in 2.3.3 (Needless to say, it also breaks =
every implementation
I have used) Is, say ??%, a "sequence which could represent trigraph", an=
d if so, by which=20
character it is replaced? And if ??? is not a trigraph, how could two tri=
graphs overlap
in first place?
I dont know what ISO/IEC 9899:1990 says about trigraphs in C, but I dont =
believe it has
meaningless rules like this.=20
Another idea. Why not mark trigraphs, digraphs, and <ciso646> deprecated,=
so that they could
be some day removed easily (terminals lacking #[]{} etc are near extincti=
on already)
--=20
Juha Niskanen | juhni@kianto.suomussalmi.fi
V=E4lsk=E4rinkuja 2B | http://kianto.suomussalmi.fi/~juhni=09
89600 =C4mm=E4nsaari | ABI 97 / UNIX hacking / programming=20
Finland
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]