Any flaws using ?? instead of L '?' with wchar_t?

Are there any drawbacks to using '?'-style literals to compare or assign values ​​known as types wchar_tinstead of using L'?'non-lowercase literals?

+5
source share
3 answers

The only drawback is that your program may crash on stone age systems using EBCDIC. In any real system, worthy of attention, value char, and wchar_tfor portable character set - it's all ASCII, and increasingly (but not all) wchar_tis the Unicode code number.

+1
source

, . ( ), (, ). .

, 0x80 - 0xff Unicode, .

, Unicode . , , mbtowcs.

'\xAB' vs L'\xAB', , , . . http://ideone.com/b1E39

+6

,

A char ( char, signed char unsigned char), char16_t, char32_t wchar_t ...

__STDC_MB_MIGHT_NEQ_WC__ :

1, , wchar_t , .

__STDC_ISO_10646__:

yyyymmL (, 199712L). , Unicode, wchar_t, , .

I am not a professional in interpreting the standard, but I think that means that the answer to your question is that they can have different ideas, and you should always use it L.

+3
source

All Articles