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

Vincent Lefèvre <vinc...@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)
gmp-devel mailing list

Reply via email to