Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
3.x
-
None
-
9702400e2d45c074922e488e01ab8ade82431b47
Description
The return type of QGLContext::getProcAddress() should be a function pointer and not a data pointer. The wrapped function glXGetProcAddress() has the correct prototype, but for some reason the QGLContext method deviates from the correct GLX API. According to the C and C++ standards, it is valid to cast between different function pointer types, as long as the actual call is made through a pointer with the original signature of the function pointed to. However, the standard explicitly does not make the same guarantee for the conversion from a function pointer to a non-function pointer and back.
Strictly speaking, it should be a pointer to a function with C linkage:
extern "C"
{ typedef void (*QGLProc)(); } ...
QGLProc getProcAddress(const QString&);
This is an API bug, and the invalid type conversion will cause compilers to complain with the right warning settings.