C++17 why not remove digraphs along with trigraphs?

Trigraphs are more problematic to the unaware user than digraphs. This is because they are replaced within string literals and comments. Here are some examples… Example A: std::string example = “What??!??!”; std::cout << example << std::endl; What|| will be printed to the console. This is because of the trigraph ??! being translated to |. Example … Read more

Are digraphs and trigraphs in use today? [closed]

I don’t know for sure, but you’re most likely to find digraphs and trigraphs being used in IBM mainframe environments. The EBCDIC character set doesn’t include some characters that are required for C. The other justification for digraphs and trigraphs, 7-bit ASCII-ish character sets that replace some punctuation characters with accented letters, is probably less … Read more

When were the ‘and’ and ‘or’ alternative tokens introduced in C++?

From the first ISO C++ standard C++98, this is described in 2.5/ Alternative tokens [lex.digraph]: Alternative token representations are provided for some operators and punctuators. In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling. The set of alternative tokens is defined in Table … Read more

Purpose of Trigraph sequences in C++?

This question (about the closely related digraphs) has the answer. It boils down to the fact that the ISO 646 character set doesn’t have all the characters of the C syntax, so there are some systems with keyboards and displays that can’t deal with the characters (though I imagine that these are quite rare nowadays). … Read more

What does the ??!??! operator do in C?

??! is a trigraph that translates to |. So it says: !ErrorHasOccured() || HandleError(); which, due to short circuiting, is equivalent to: if (ErrorHasOccured()) HandleError(); Guru of the Week (deals with C++ but relevant here), where I picked this up. Possible origin of trigraphs or as @DwB points out in the comments it’s more likely … Read more