kito-cheng added a comment.

My understanding is the reason why no global variable is because 1. the 
initialization order and 2. might increase the launch time of programs, moving 
that into function scope could resolve both issue: 1. initialized in 
deterministic order[1], 2. Initialized that when the first time used.

[1] 
https://stackoverflow.com/questions/49856152/static-function-variable-initialization-order-in-the-same-function
[2] 
https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables

- stackoverflow and cppreference might not formal source, but should be enough 
here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128726/new/

https://reviews.llvm.org/D128726

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to