[clang] [clang] Improve the documentation for the init_priority attribute (PR #123098)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 16 14:20:09 PST 2025


================
@@ -121,11 +121,12 @@ def InitPriorityDocs : Documentation {
 In C++, the order in which global variables are initialized across translation
 units is unspecified, unlike the ordering within a single translation unit. The
 ``init_priority`` attribute allows you to specify a relative ordering for the
-initialization of objects declared at namespace scope in C++. The priority is
-given as an integer constant expression between 101 and 65535 (inclusive).
-Priorities outside of that range are reserved for use by the implementation. A
-lower value indicates a higher priority of initialization. Note that only the
-relative ordering of values is important. For example:
+initialization of objects declared at namespace scope in C++, even between translation
+units (but within a single final linked image). The priority is given as an integer
----------------
ldionne wrote:

I agree this reads better. I am not certain about how this is handled with DLLs, maybe someone like @rnk would know?

https://github.com/llvm/llvm-project/pull/123098


More information about the cfe-commits mailing list