mini-gmp mpz_{get,set}_d not fully compatible with GMP

Adrien Prost-Boucle adrien.prost-boucle at
Sun Mar 11 11:42:16 UTC 2018

On Sun, 2018-03-11 at 00:15 +0100, Niels Möller wrote:
> so that the initializer is evaluated exactly once, after the first entry
> to the function, but before any thread uses the value (likely generating
> code using pthread_once). Has anything like that made it into recent C
> standards?

__attribute__ ((constructor)) is one possible solution,
if you isolate your critical init part in a function.

About it being in a standard or not, I don't know.
But it's pretty common, and handled by clang and gcc.
So it should be rather reliable.


More information about the gmp-devel mailing list