Default type of 'char' in Android NDK.

63 views
Skip to first unread message

Raj Shekar

unread,
Feb 9, 2021, 1:16:57 PM2/9/21
to andro...@googlegroups.com
Hi All,

We have ported a C application on to Android and due to historical reasons we need to have the default type of C 'char' to be unsigned. As we know the default type of 'char' in Android NDK is indeed unsigned but couldn't find any official documentation for the same. Can anyone please confirm this and provide a link to official documentation.

NdkVersion "20.0.5594570"
CMake version "3.10.2"

1. To our surprise, we are getting warnings while passing 'unsigned const char *' variables to functions which accept 'const char *' (example: to strcmp() or strncpy() ).. since the default type is unsigned char, these warnings should not be reported. If I use the flag -Wno-pointer-sign as cmake flag in master CMakeLists.txt, then the warnings get suppressed, but I don't want to suppress them this way but want to fix it the right way. I have tried using the below flags in the app's build.gradle file but wasn't good enough.

        externalNativeBuild {
            cmake {
                cppFlags "-funsigned-char"
                cFlags "-funsigned-char"
            }

2. We are building our app for only 32-bit architecture. We are aware that Google has mandated to provide 64-bit native binaries since August 1, 2019, but currently we don't use Play Store and until we are ready with 64-bit binaries we would like to suppress the warnings which report that we are not building 64-bit native binaries.

So, how can I suppress these warnings, we have a lot of native binaries and for each binary these warning lines are generated.

WARNING: This app only has 32-bit [armeabi-v7a,x86] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
This app only has 32-bit [armeabi-v7a,x86] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement

Thanks in advance.

Thanks,
Raj.
Reply all
Reply to author
Forward
0 new messages