View Full Version : glintptr?

11-13-2006, 12:19 PM
What is this data type?


It's on the new extension ext_bindable_uniform and I can't find what GL data type this is supposed to be. Thanks

11-13-2006, 12:33 PM
naively, I would guess :

typedef *int GLintptr;

11-13-2006, 03:40 PM
I would to ZbuffeR but MSVC shows typedef ptrdiff_t

I have never seen that before...

11-13-2006, 03:42 PM
Well here is the lowd down.

C and C++ define a special type for pointer arithmetic, namely ptrdiff_t, which is a typedef of a platform-specific signed integral type. You can use a variable of type ptrdiff_t to store the result of subtracting and adding pointers. For example:

#include <stdlib.h>
int main()
int buff[4];
ptrdiff_t diff = (&buff[3]) - buff; // diff = 3
diff = buff -(&buff[3]); // -3

What are the advantages of using ptrdiff_t? First, the name ptrdiff_t is self-documenting and helps the reader understand that the variable is used in pointer arithmetic exclusively. Secondly, ptrdiff_t is portable: its underlying type may vary across platforms, but you don't need to make changes in the code when porting it.

11-13-2006, 11:15 PM
Thanks for the clarifications.