wchar_t in Android NDK

  • 1165
  • 0

摘要:wchar_t in Android NDK

 

the size of wchar_t is 4 not 16(linux) neither 8(windows)
 
this make me suprise....
 
http://stackoverflow.com/questions/5630255/does-android-not-really-have-wchar-t
 
Android wchar_t 中槍.....
5.2/ wchar_t support:
- - - - - - - - - - -
 
As documented, the Android platform did not really support wchar_t until
Android 2.3. What this means in practical terms is that:
 
  - If you target platform android-9 or higher, the size of wchar_t is
    4 bytes, and most wide-char functions are available in the C library
    (with the exception of multi-byte encoding/decoding functions and
     wsprintf/wsscanf).
 
  - If you target any prior API level, the size of wchar_t will be 1 byte
    and none of the wide-char functions will work anyway.
 
We recommend any developer to get rid of any dependencies on the wchar_t type
and switch to better representations. The support provided in Android is only
there to help you migrate existing code.