Most of the sites I've been reading state that a zero-sized array, single element array or Flexible Array Members is the way to go when a dynamic array is needed, but the definition of an integer in GMP's source code is a pointer at the end of the struct (__mpz_struct), why is that?
I was expecting it to use zero-sized arrays, single element arrays or FAM
__mpz_struct. But, this is semi-hidden. One usesmpz_t:typedef __mpz_struct mpz_t[1];so one can pass around what looks like numbers "passed by value" when, in fact, we're passing around pointers.__mpz_structhasmp_limb_t *which is where the variable length data is stored.mp_limb_tcan be uint32_t or uint64_t (or even uint16_t). This depends upon what the "natural" register/integer size is for the processor we're building for (e.g.): uint16_t for 8086, uint32_t for i386, uint64_t for x86_64. This is something that the lib worries about so we don't have to.int data[];as the last element of the struct. No, it can't be used in GMP because the library must be able to grow/shrink the array at will. For example, if we use GMP to iterate factorials from 1 to N, we start with just one limb but grow to thousands (or millions) as needed. FAM can't do this for GMP.