For consistency with other platforms, I need to use signed char
in some native code I'm working on. But by default on Android NDK char
type is unsigned
.
I have tried to explicitly use signed char
type but it generates too many warnings differ in signedness
when string constant/library functions are involved, so I'm looking to build my code with -fsigned-char
.
I'm now trying to anticipate problems regarding Android ARM ABI and API when -fsigned-char
is used, but I can't find any problem yet.
In Procedure Call Standard for the ARM Architecture
ABI (AAPCS), 7.1.1 Arithmetic Types, and C Library ABI for the ARM Architecture , 5.6 inttypes.h, char
is said to be unsigned
.
Did you know if there Will be some trouble when using C library (others libraries available on Android) when -fsigned-char
is enabled in Android NDK?
I have also encountered this issue tonight. char
is treat as signed
on x86, but changed to unsigned
when run on Android device. This make my JNI libs don't work properly.
After setting LOCAL_CFLAGS := -fsigned-char
in Android.mk, my program works! Currently I found no side effect. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With