C90和C99之间的字符差异 [英] Char difference between C90 and C99

查看:234
本文介绍了C90和C99之间的字符差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的C人,


C90没有说明''char''是''signed char''还是''unsigned char''

将它留给编译器的实现。这改变了

C99,还是一样?


谢谢,

杰森。

Dear C people,

C90 doesn''t specify if ''char'' is either ''signed char'' or ''unsigned char''
leaving it to the implementation of the compiler. Has this changed for
C99, or is it still the same?

Thanks,
Jason.

推荐答案

Jason Curl< j _ ******** @ motorola.com>写道:
Jason Curl <j_********@motorola.com> writes:
C90没有指定''char''是''signed char''还是''unsigned
char''将它留给编译器的实现。这个更改为C99,还是一样?
C90 doesn''t specify if ''char'' is either ''signed char'' or ''unsigned
char'' leaving it to the implementation of the compiler. Has this
changed for C99, or is it still the same?




还是一样。


- -

Keith Thompson(The_Other_Keith) ks***@mib.org < http:// www .ghoti.net / ~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



Still the same.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


On Tue,2005年6月21日08:57:10 +0200,Jason Curl写道:
On Tue, 21 Jun 2005 08:57:10 +0200, Jason Curl wrote:
亲爱的C人,

C90没有说明''char''是''signed char''还是''unsigned char''


它表示char与

具有相同的范围,表示和行为,无论是signed char还是unsigned char。然而,两者仍然是一个独特的类型

。这意味着例如


char * p1 = NULL;

signed char * p2 = p1;


是即使在char具有签名表示的实现上也是无效的。

将它留给编译器的实现。这是否改为
C99,还是一样?
Dear C people,

C90 doesn''t specify if ''char'' is either ''signed char'' or ''unsigned char''
It says that char has the same range, representation and behaviour as
either signed char or unsigned char. However it is still a distinct type
from both. That means for example

char *p1 = NULL;
signed char *p2 = p1;

is invalid even on implementations where char has a signed representation.
leaving it to the implementation of the compiler. Has this changed for
C99, or is it still the same?




是的,它是一样的。


Lawrence



Yes, it is the same.

Lawrence




" Lawrence Kirby" < LK **** @ netactive.co.uk>在消息中写道

news:pa **************************** @ netactive.co.u k。 ..

"Lawrence Kirby" <lk****@netactive.co.uk> wrote in message
news:pa****************************@netactive.co.u k...
On Tue,2005年6月21日08:57:10 +0200,Jason Curl写道:
On Tue, 21 Jun 2005 08:57:10 +0200, Jason Curl wrote:
亲爱的C人,

Dear C people,

C90 doesn''t specify if ''char'' is either ''signed char'' or ''unsigned char''



它说char具有相同的范围,表示和行为为
签名char或unsigned char。然而,两者仍然是一种截然不同的类型。这意味着例如

char * p1 = NULL;
signed char * p2 = p1;

即使在char具有签名表示的实现上也是无效的。



It says that char has the same range, representation and behaviour as
either signed char or unsigned char. However it is still a distinct type
from both. That means for example

char *p1 = NULL;
signed char *p2 = p1;

is invalid even on implementations where char has a signed representation.




我不明白什么是无效这意味着。

演员是否有效?

ie

char * p1 = NULL;

签名char * p2 =(signed char *)p1;



I don''t understand what "invalid" means here.
Would a cast make it valid?
i.e.
char *p1 = NULL;
signed char *p2 = (signed char*)p1;

将其留给编译器的实现。这是否已经改为
C99,还是仍然相同?
leaving it to the implementation of the compiler. Has this changed for
C99, or is it still the same?



是的,它是一样的。

劳伦斯



Yes, it is the same.

Lawrence



这篇关于C90和C99之间的字符差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆