2

Note that the * in the title is meant to be a placeholder, in my case the culprit was ??[.

I just came over C++ (also "C") escape sequences, formed by double question marks. What was this ever used for and why is it still there?

I have ascii-85 encoded text where double question marks seldom occur and just spent an afternoon ripping the hair from my head while attempting to find a bug in the encoder / decoder, while it was simply the compiler playing tricks on me.

Community
  • 1
  • 1
the swine
  • 10,713
  • 7
  • 58
  • 100
  • 2
    [Trigraphs](http://en.wikipedia.org/wiki/Digraphs_and_trigraphs) are pretty useless nowadays and are not going to be in C++17. See the proposal: [Removing Trigraphs??!](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4086.html) – chris Jul 31 '14 at 12:58
  • @chris That's an interesting and exciting development indeed! – the swine Jul 31 '14 at 12:59
  • And of course, C++ got them from C, where they are still (as far as I know) standard. – James Kanze Jul 31 '14 at 14:18
  • @JamesKanze you're right, I was confused since http://en.wikipedia.org/wiki/Escape_Sequences_in_C does not explicitly mention `??`, while http://en.cppreference.com/w/cpp/language/escape does. – the swine Jul 31 '14 at 14:45
  • @JamesKanze: re the "still" in your comment, trigraphs are still standard in C++. AFAIK they will not be removed in C++14 either. – Cheers and hth. - Alf Jul 31 '14 at 14:59
  • @Alf Of course they're still in C++. No one said anything to the contrary. But it was said that they weren't in C. – James Kanze Jul 31 '14 at 17:50
  • The trigraphs aren't escape sequences, they're trigraphs. They may seem similar, but the standard keeps them separate. – James Kanze Jul 31 '14 at 17:51

1 Answers1

1

From the C++ Standard

2.4 Trigraph sequences [lex.trigraph]

1 Before any other processing takes place, each occurrence of one of the following sequences of three characters (“trigraph sequences”) is replaced by the single character indicated in Table 1. Table 1 — Trigraph sequences Trigraph Replacement Trigraph Replacement Trigraph Replacement

??= # ??( [ ??< {
??/ \ ??) ] ??> }
??’ ˆ ??! | ??- ~

However the symbol you showed ??* is not a trigraph symbol. So it is difficult to say what it means.

It seems I have understood what it means. They are wild characters ? and * Simply inside a string literal symbol ? was doubled.:)

the swine
  • 10,713
  • 7
  • 58
  • 100
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335