Jump to content

Talk:Digraphs and trigraphs (programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Eliyahu S (talk | contribs) at 09:52, 7 December 2009 (Applicability: Answer about trigraph's history in C). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

I very much doubt that this phrase "replaces all occurrences" is correct (my emphasis). For example, it should not replace occurences of that sequence within strings.

It is correct.
Sadly. This is a prime example of design by committee

escape

Is the \? escape really standard, or just typical? Might there be a compiler that maps it to the 0xfe character or similar? AlbertCahalan 04:06, 23 April 2006 (UTC)[reply]

Standard. Akihabara 04:21, 29 November 2006 (UTC)[reply]

IOCCC

Should something be added about the more notorious uses of trigraphs (i.e. obfuscation)? Amcfreely 04:07, 23 April 2006 (UTC)[reply]

Applicability

When were trigraphs introduced? Do they only apply to ISO C, for instance? Have any other languages adopted them? --82.46.154.93 03:38, 27 November 2006 (UTC)[reply]

  • They hark back to the very origins of C. The first edition of K & R refers (in the appendix) to the C compiler having been implemented on four computer platforms, and one of them is the IBM 360/370. Well, that compiler had to implement trigraphs because it was processing EBCDIC! I personally used it, and even had to do maintenance on the very C compiler discussed in the book, back in the early 80's, --Eliyahu S Talk 09:52, 7 December 2009 (UTC)[reply]

Redundant digraph

The bit at the bottom on digraphs lists "%:" as a digraph for "#", and "%:%:" as a digraph for "##". Surely the second one is simply two adjacent digraphs?--NeilMitchell 19:55, 16 September 2007 (UTC)[reply]

"A digraph [...] must always represent a full token by itself." # and ## are different tokens. --62.224.99.108 14:03, 3 December 2007 (UTC)[reply]

Can they or can't they be used?

This sentence is unclear:

The C grammar does not permit two subsequent ? tokens, so the only places in a C file where two question marks in a row may be used are in multi-character constants, string literals, and comments.

The whole article seems to say that trigraphs are, in fact, interpreted within constants, literals, and comments - which would imply that you cannot use two question marks in a row there (unless you want them to be interpreted as introducing a trigraph). But this sentence says you can use them there.

I'm not sure what the author meant to say, but I suspect that this wasn't it. JayLevitt 13:41, 7 November 2007 (UTC)[reply]

A token is different from a character. In a-=b], there are three tokens: a, -= (two characters but one token), b. But in a=-b, there are four tokens: a, =, -, b], and in "a--b", there is only one token: "a--b" (six characters, indicating a 5-bit (null-ended) array of characters.
What the sentence is saying is that there is no place in C where a ? token can be immediately followed by another ? token. Inside quotation marks (i.e. multi-character constants or string literals) and inside comments, two subsequent question marks would not be parsed as individual tokens... they would be parsed as part of the string or ignored as part of the comment.
ΨΦorg 13:54, 7 November 2007 (UTC)[reply]

Perl section

I don't know Perl, but the Perl section does not seem to deal with di- and trigraph substitution, it's rather more a list of operators. What are those supposed di- and trigraphs replaced with? 221.187.58.252 (talk) 07:01, 27 April 2009 (UTC)[reply]

LaTeX section

Are escape characters digraphs in LaTeX ? Snide (talk) 15:05, 29 May 2009 (UTC)[reply]