Skip to content

Commit b982fb2

Browse files
author
Colin Robertson
committed
Clean up wording, example
1 parent f3031cc commit b982fb2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/error-messages/compiler-errors-1/compiler-error-c2482.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ ms.workload: ["cplusplus"]
1616

1717
>'*identifier*' : dynamic initialization of 'thread' data not allowed in managed/WinRT code
1818
19-
In managed or WinRT code, variables declared by using the [__declspec(thread)](../../cpp/thread.md) storage class modifier attribute or the [thread_local](../../cpp/storage-classes-cpp.md#thread_local) storage class specifier cannot be initialized with an expression that requires run-time evaluation. A static expression is required to initialize `__declspec(thread)` or `thread_local` data.
19+
## Remarks
20+
21+
In managed or WinRT code, variables declared by using the [__declspec(thread)](../../cpp/thread.md) storage class modifier attribute or the [thread_local](../../cpp/storage-classes-cpp.md#thread_local) storage class specifier cannot be initialized with an expression that requires run-time evaluation. A static expression is required to initialize `__declspec(thread)` or `thread_local` data in these runtime environments.
2022

2123
## Example
2224

23-
The following sample generates C2482 in managed (**/clr**) and and WinRT (**/ZW**) code:
25+
The following sample generates C2482 in managed (**/clr**) and in WinRT (**/ZW**) code:
2426

2527
```cpp
2628
// C2482.cpp
27-
// For managed example, compile with: /EHsc /c /clr C2482.cpp
28-
// For WinRT example, compile with: /EHsc /c /ZW C2482.cpp
29+
// For managed example, compile with: cl /EHsc /c /clr C2482.cpp
30+
// For WinRT example, compile with: cl /EHsc /c /ZW C2482.cpp
2931
#define Thread __declspec( thread )
3032
Thread int tls_i1 = tls_i1; // C2482
3133

0 commit comments

Comments
 (0)