I pass in an array of vertex indices in some GL code ... each element is GLushort
I want to finish using a sentinel device to avoid the painstaking passage of the length of the array each time along with the array itself.
#define SENTINEL ( (GLushort) -1 )
:
GLushort verts = {0, 0, 2, 1, 0, 0, SENTINEL};
I cannot use 0 to complete, as some of the elements have a value of 0
Is it possible to use -1?
As I understand it, this will lead to the maximum integer that GLushort can represent, which would be ideal.
But is this behavior guaranteed in C?
(I cannot find the equivalent constant MAX_INT for this type, otherwise I would use this)
source
share