I am wondering how can I check an array is static or dynamically allocated. I looked up online and found the following implementation in mysql source code, I don't know why this works ? (line 0303 checks if the array is static)
/*
0301 Just mark as empty if we are using a static buffer
0302 */
0303 if (array->buffer == (uchar *)(array + 1))
0304 array->elements= 0;
This is the definition of DYNAMIC_ARRAY in mysql :
341
342 typedef struct st_dynamic_array
343 {
344 uchar *buffer;
345 uint elements,max_element;
346 uint alloc_increment;
347 uint size_of_element;
348 } DYNAMIC_ARRAY;
array.std::vector.