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

Torbjörn Granlund tg at
Tue Mar 13 14:34:26 UTC 2018

nisse at (Niels Möller) writes:

  Does C11 provide any way to initialize a local static variable, like in
  recent C++? I.e., not code running before main, but code running the
  first time the function is entered, and guaranteed to run just once?

  > I don't think volatile matters. AFAIK, what you need is _Atomic (C11).

  If we can make this thread safe with C11, I think it's fine to document
  that mini-gmp requires C11 for thread safety. (I'd still prefer the
  simpler way of reying on float.h constants, though).

Let's remind ourselves that we are not executing GMP on a standards
document, but on actual computer systems.  :-)

Store reordering is an actual problem which we should keep in mind (but
note that x86 implements total store ordering).  Non-atomic loads/stores
is not as long as we keep to short types.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list