“??*” C++ escape sequence [duplicate]

断了今生、忘了曾经 提交于 2021-01-20 09:17:05

问题


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.


回答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.:)



来源:https://stackoverflow.com/questions/25059452/c-escape-sequence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!