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

Vincent Lefevre vincent at vinc17.net
Tue Mar 13 15:56:24 UTC 2018


On 2018-03-13 15:12:27 +0100, Niels Möller wrote:
> 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 so. 6.7.9p4 says "All the expressions in an initializer
for an object that has static or thread storage duration shall be
constant expressions or string literals." and function calls (in
particular) are not possible in constant expressions. So, nothing
portable.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list