C89下的SIZE_MAX [英] SIZE_MAX under c89

查看:161
本文介绍了C89下的SIZE_MAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了c89标准,我在任何地方都看不到SIZE_MAX

。那么这是c99的新成员?这不合法,因为c89

没有定义SIZE_MAX,只使用#define SIZE_MAX(size_t)-1?


-

aegis

I''ve looked through the c89 standard and I do not see SIZE_MAX
anywhere. So this was a new addition to c99? Isn''t it legal, since c89
does not define SIZE_MAX, to just use #define SIZE_MAX (size_t)-1 ?

--
aegis

推荐答案

aegis写道:
我看过了c89标准,我在任何地方都看不到SIZE_MAX。那么这是c99的新成员?是不是合法,因为c89
没有定义SIZE_MAX,只使用#define SIZE_MAX(size_t)-1?
I''ve looked through the c89 standard and I do not see SIZE_MAX
anywhere. So this was a new addition to c99? Isn''t it legal, since c89
does not define SIZE_MAX, to just use #define SIZE_MAX (size_t)-1 ?




你的意思是

#define SIZE_MAX(sizeof(size_t)-1)





do you mean
#define SIZE_MAX (sizeof (size_t) -1)

?


Op 5 Jun 2005 15:05:25 -0700 schreef aegis:
Op 5 Jun 2005 15:05:25 -0700 schreef aegis:
我已经查看了c89标准,我在任何地方都看不到SIZE_MAX。那么这是c99的新成员?这不是合法的,因为c89
没有定义SIZE_MAX,只使用#define SIZE_MAX(size_t)-1?
I''ve looked through the c89 standard and I do not see SIZE_MAX
anywhere. So this was a new addition to c99? Isn''t it legal, since c89
does not define SIZE_MAX, to just use #define SIZE_MAX (size_t)-1 ?




我不喜欢知道你的第一个问题的答案,我没有c89。

#define似乎错了,SIZE_MAX是一个常数,size_t是一个类型。

也许#define SIZE_MAX UINT_MAX会这样做。

-

Coos



I don''t know the answer to your first question, I don''t have c89.
The #define seems wrong, SIZE_MAX is a constant, size_t is a type.
Perhaps #define SIZE_MAX UINT_MAX will do.
--
Coos


goose< ru ** @ webmail。 co.za>写道:
goose <ru**@webmail.co.za> writes:
aegis写道:
我已经查看了c89标准,我没有在任何地方看到SIZE_MAX
。那么这是c99的新成员?是不是合法,因为c89
没有定义SIZE_MAX,只使用#define SIZE_MAX(size_t)-1?
I''ve looked through the c89 standard and I do not see SIZE_MAX
anywhere. So this was a new addition to c99? Isn''t it legal, since c89
does not define SIZE_MAX, to just use #define SIZE_MAX (size_t)-1 ?



你的意思是
#定义SIZE_MAX(sizeof(size_t)-1)



do you mean
#define SIZE_MAX (sizeof (size_t) -1)




嗯,不。如果size_t是4个字节,则将SIZE_MAX定义为3.


-

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

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

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



Um, no. If size_t is 4 bytes, that defines SIZE_MAX as 3.

--
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.


这篇关于C89下的SIZE_MAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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