为什么 GLsizei 没有定义为无符号?
我正在查找 iOS 上 OpenGL ES 1.1 实现的 GLsizei
的 typedef
,并惊讶地发现它被定义为 int
。一些快速谷歌搜索表明这是正常的。 (包括在普通 OpenGL 上。)
我期望它将被定义为 unsigned int
或 size_t
。为什么它被定义为普通的int
?
I was looking up the typedef
of GLsizei
for the OpenGL ES 1.1 implementation on iOS, and was surprised to find that it was defined as an int
. Some quick googling showed that this is normal. (Including on normal OpenGL.)
I was expecting that it would be defined as an unsigned int
or size_t
. Why is it defined as just a vanilla int
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎不太可能成为问题,除非您有任何 4GB 的数据结构。
这是某人的答案: http://oss.sgi.com/archives /ogl-sample/2005-07/msg00003.html
两种解释似乎都有道理 - 我在许多方面遇到了 1)我自己也曾愚蠢地使用 NSUInteger 作为循环计数器(提示:不要这样做,尤其是倒数到零时)。
It seems unlikely to be a problem, unless you have any 4GB data structures kicking around.
Here's someone's answer: http://oss.sgi.com/archives/ogl-sample/2005-07/msg00003.html
Both explanations seem plausible - I've run into 1) on a number of occasions myself when stupidly using NSUInteger for a loop counter (hint: don't do that, especially when counting backwards down to zero).