The OpenGL specification (glspec45.core.pdf) defines the exact bit width for all types GL...:
GL...
2.2.1 Data Transformation for State Setting Commands...The implementation must accurately use the number of bits indicated in the table to represent the GL type....
But the so-called OpenGL registry (gl.xml is the official analytical specification of the OpenGL API) naively defines these types as aliases for the corresponding C types.
... <type>typedef short <name>GLshort</name>;</type> <type>typedef int <name>GLint</name>;</type> <type>typedef int <name>GLclampx</name>;</type> ...
This is potentially dangerous.
Why weren't fixed-width types used instead?
? ?
, / OpenGL, ?
.
, .
?
, / , , . GCC, Clang, V++ . Windows, MacOS, Linux, Android, iOS ABI.
C ++. , . , , OpenGL .
OpenGL . : C99/++ 11; OpenGL 1992 .
1992 ++ . " " ? , OpenGL C, C .
, gl.xml, .
, , glew.h, OpenGL .
glew.h
:
#if defined(_MSC_VER) && _MSC_VER < 1400 typedef __int64 GLint64EXT; typedef unsigned __int64 GLuint64EXT; #elif defined(_MSC_VER) || defined(__BORLANDC__) typedef signed long long GLint64EXT; typedef unsigned long long GLuint64EXT; #else # if defined(__MINGW32__) || defined(__CYGWIN__) #include <inttypes.h> # endif typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; #endif
Source: https://habr.com/ru/post/1664835/More articles:Haskell Servant передает пользовательские данные обработчику auth - authenticationDjango ImportError: unable to import name 'x' - pythonUnable to load Drawable vector in XML bitmap - androidHow to split a string based on the general format of a split block? - stringpygame.mixer.Sound.play is irregular, although it quits regularly - pythonWhy use this comma in this return expression? - c ++Do something every x (milli) seconds in pygame - functionPackage versus namespace versus module - moduleMake the "Related" section based on the same category in laravel - phpEntity Framework saves IP as binary for SQL Server - c #All Articles