The documentation -fshort-wchar reads,
-fshort-wchar
Cancel the base type for wchar_t as short unsigned int instead of the default value for the target. This option is useful for creating programs that run under WINE.
Warning: the -fshort-wchar switch causes GCC to generate code that is not binary compatible with code generated without this switch. Use it to match the binary interface of a non-standard application.
Thus, it seems that this flag causes an observed mismatch, and since the language specification does not speak of such a flag, the behavior can be classified as implementation-defined or undefined.
As a side element, you should use wcout instead of cout when working with wide characters, since wcout designed to handle wide characters:
cout - an object of type basic_ostream<char> .wcout - an object of type basic_ostream<wchar_t> .
In this case, the problem is not that you are using values ββto print, since you are telling the compiler to treat wchar_t as a short unsigned int , anyway.
Nawaz source share