使用GLuint而不是unsigned int的优点是什么? [英] What's the advantage of using GLuint instead of unsigned int?
问题描述
我喜欢更标准的可能,所以为什么我应该约束我的类定义它的成员作为OpenGL类型,当我可以使用原始类型?是否有任何优势?
I like to be more standard as possible, so why should I "constrain" my classes defining it's members as OpenGL types when I can use primitive types? Is there any advantage?
推荐答案
类型unsigned int根据您构建的平台而有不同的大小。我期望这通常是32位,但它可以是16或64(或其他 - 取决于平台)。
The type "unsigned int" has a different size depending on the platform you're building on. I expect this to normally be 32 bits, however it could be 16 or 64 (or something else -- depending on the platform).
库特定类型通常创建根据平台特定的规则被typedef。这允许通用应用程序使用正确的类型,而不必知道它将被构建的平台。相反,平台特定的知识被限制到单个公共头文件。
Library-specific types are often created to be typedef'd according to platform-specific rules. This allows a generic application to use the right type without having to be aware of the platform it will be built for. Instead, the platform-specific knowledge is constrained to a single common header file.
这篇关于使用GLuint而不是unsigned int的优点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!