本文介绍了任何编译器将'char'作为'unsigned'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何C编译器将默认类型的char作为unsigned,除非用户在文件或项目设置中明确提到。

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?

/ Kanu _

推荐答案

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年: ARM编译器(gcc,clang) Android NDK默认为 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'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 15:20