I have known this problem is compiler-dependent. So I want a reliable method to determine.
For example:
const wchar_t str[] = L"飞流直下三千尺";
How should I know whether str is little-endian or big-endian?
Is there a compiler’s guarantee that the endianness of a wide string literal is the same one as the target architectures?
There’s no compiler guarantee that
wchar_teven has an endianness (or that it’s Unicode, for that matter).