[libcxx-commits] [PATCH] D104987: Use GetSystemTimePreciseAsFileTime() if available
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 26 11:06:17 PDT 2021
mstorsjo added a comment.
In D104987#2967640 <https://reviews.llvm.org/D104987#2967640>, @ldionne wrote:
> In D104987#2967333 <https://reviews.llvm.org/D104987#2967333>, @mstorsjo wrote:
>
>> In D104987#2967130 <https://reviews.llvm.org/D104987#2967130>, @ldionne wrote:
>>
>>> LGTM, but the only question I have is whether we should initialize this at file scope so as to avoid a function-local static? As it stands, we're going to be checking whether the function-local static is initialized every time we enter the function, which seems undesirable for a function like `system_clock::now()`.
>>
>> Thanks, that’s a good point. Initially I was about to respond that it’s a tradeoff between startup time and runtime - but I guess libc++ has a fair number of global startup constructors anyway, so it’s probably not a big deal anyway.
>>
>> However - as the initialization order of global constructors is undefined, wouldn’t it be an issue if it’s used from a constructor in user code?
>
> We could use the `init_priority` attribute to enforce that this `static` is initialized before other statics. Either way works for me.
Oh, right, we have a neat macro for that already (_LIBCPP_INIT_PRIORITY_MAX), that’s probably the best solution. Thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104987/new/
https://reviews.llvm.org/D104987
More information about the libcxx-commits
mailing list