-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: deprecated use of std::char_traits<unsigned short>::length #791
base: master
Are you sure you want to change the base?
Conversation
@codeinred Since we've decided to make C++11 a requirement for future versions of JavaCPP, let's just replace unsigned short with char16_t. Thanks! _Originally posted by @saudet in bytedeco#753 (comment) warning: 'char_traits<unsigned short>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it. [-Wdeprecated-declarations]
Having one issue about doing this: |
Apparently this is safe to cast from char16_t to jchar It is generally safe to cast char16_t* to jchar* in JNI, as both types are 16-bit wide and represent UTF-16 encoded characters. This approach is commonly used in JNI code to handle UTF-16 strings. Here’s a brief explanation: char16_t: A 16-bit character type introduced in C++11 to represent UTF-16 encoded characters. -- Using reinterpret_cast ensures that the conversion is done correctly at the bit level, which is necessary for this specific case in JNI where char16_t and jchar are essentially the same type but with different names. |
There a few other places where we could switch from |
It looks like it doesn't work at all if we don't change all |
Please fix the builds |
Fix the warning about deprecated use of char_traits by char_traits<char16_t> as it has been discussing in this thread:
@codeinred Since we've decided to make C++11 a requirement for future versions of JavaCPP, let's just replace unsigned short with char16_t. Thanks!
Originally posted by @saudet in #753 (comment)
--
Original issue is;
warning: 'char_traits' is deprecated: char_traits for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it. [-Wdeprecated-declarations]