В чем разница префикса U для символьного литерала и строкового литерала?C++

Программы на C++. Форум разработчиков
Anonymous
В чем разница префикса U для символьного литерала и строкового литерала?

Сообщение Anonymous »


In The C++ Programming Language C++ 4th edition, section 6.2.6, it says:

Combinations of R, L, and u prefixes are allowed, for example, uR"\*\*(foo\\(bar))\*\*". Note the dramatic difference in the meaning of a U prefix for a character (unsigned) and for a string UTF-32 encoding (§7.3.2.2).

I don't quite understand what the author is trying to say here. What is the "dramatic difference" indeed? Why is the word "(unsigned)" used here?

Per my understanding, a U-prefixed character literal contains the ISO-10646 code point value of the quoted character, which is basically of the same idea as the U prefix of a string literal, and has nothing to do with the concept of "unsigned".


Источник: https://stackoverflow.com/questions/214 ... tring-lite

Вернуться в «C++»