How to force char to be signed_char

399 views
Skip to first unread message

Dave

unread,
Jun 18, 2010, 1:47:24 PM6/18/10
to android-ndk
Hi all,

I am compiling a large amount of C and C++ code using the NDK. Found
and tracked down a problem that occurs only on this platform and not
when used on many other platforms- the standard:

char array[10];

or

char charval;

is being treated as an unsigned char. On other platforms it's treated
as a signed char. Apparently this is a known fact with ARM
compilation when using GCC. Supposedly you can do this:

gcc -fsigned_char file.c

to force chars to be signed_char. But since we don't have the ability
to pass variables to gcc here, we are supposed to use:

LOCAL_CFLAGS := -fsigned_char

Unfortunately that gives me the compiler error:
cc1plus: error: unrecognized command line option "-fsigned_char"

Does anyone know how I can make this adjustment to the compiler? I'd
really like to not have to search through 100s of thousands of lines
of code changing all char definitions to signed char!

Thanks in advance!

Onur Cinar

unread,
Jun 20, 2010, 1:32:38 AM6/20/10
to android-ndk

Hi Dave,

Instead of underscore try with a minus sign between signed and char,
it should work:

LOCAL_CFLAGS := -fsigned-char

Regards,

-onur
---
www.zdo.com
Reply all
Reply to author
Forward
0 new messages