任何将 'char' 视为 'unsigned' 的编译器? [英] Any compiler which takes 'char' as 'unsigned' ?
问题描述
是否有任何 C 编译器将默认类型的 char 视为无符号,除非用户在文件或项目设置中明确提及?
Is there any C compiler which takes the default type of char as unsigned unless explicitly mentioned by the user in the file or project settings?
/卡努_
推荐答案
GCC 可以.但仅在为约定为 unsigned char 的平台编译时,包括 ARM linux[*].当 GCC 为 x86 编译时,默认为 char 被签名.
GCC does. But only when compiling for platforms where an unsigned char is the convention, including ARM linux[*]. When GCC compiles for x86, the default is for char to be signed.
[*] 或者至少在过去是这样.据我所知,从那以后,Linux 已经在 ARM 上切换到了不同的默认 ABI.
[*] Or at least it has been in the past. For all I know linux has switched to a different default ABI on ARM since.
2013 年更新: 适用于 Android NDK 的 ARM 编译器(gcc、clang)默认为 unsigned char
.x86 和 MIPS 编译器默认为 signed char
.
Update '2013: ARM compilers (gcc, clang) for Android NDK default to unsigned char
. The x86 and MIPS compilers default to signed char
.
这篇关于任何将 'char' 视为 'unsigned' 的编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!