Skip to content

Update attributes.md - remove duplicate entries #4537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions docs/cpp/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,40 +167,3 @@ The Microsoft-specific attribute `[[msvc::noinline_calls]]` has the same usage a
### `[[msvc::no_tls_guard]]`

The Microsoft-specific `[[msvc::no_tls_guard]]` attribute disables checks for initialization on first access to thread-local variables in DLLs. The checks are enabled by default in code built using Visual Studio 2019 version 16.5 and later versions. This attribute applies only to the specific variable that follows it. To disable checks globally, use the [`/Zc:tlsGuards-`](../build/reference/zc-tlsguards.md) compiler option.

### `[[msvc::forceinline]]`

This Microsoft specific `[[msvc::forceinline]]` attribute has the same meaning as `__forceinline` when placed before a function declaration.

### `[[msvc::forceinline_calls]]`

This Microsoft specific `[[msvc::forceinline_calls]]` attribute can be placed on before a statement or a block, and will cause the inline heurisitc to attempt to forceinline all calls in that statement or block:

```cpp
void f() {
[[msvc::forceinline_calls]]
{
foo();
bar();
}
...
[[msvc::forceinline_calls]]
bar();

foo();
}
```

Here, the first call to `foo` and both calls to `bar` will be treated as if they were declared `__forceinline`, but not the second call to `foo`.

### `[[msvc::noinline]]`

This Microsoft specific `[[msvc::noinline]]` attribute has the same meaning as `declspec(noinline)` when placed before a function declaration.

### `[[msvc::noinline_calls]]`

This Microsoft specific `[[msvc::noinline_calls]]` attribute has the same usage as `[[msvc::forceinline_calls]]`, and can be placed before any statement or block. Rather than forceinlining all calls in that block, however, it has the effect of turning off inlining for the scope to which it is applied.

### `[[msvc::flatten]]`

This Microsoft specific `[[msvc::flatten]]` attribute is very similar to `[[msvc::forceinline_calls]]`, and can be used in the same places and in the same way. The difference is flatten will dutifully forceinline all calls in the scope to which it is applied recursively, until no calls are left. This may have consequences for the resulting code size growth of the function or the throughput of the compiler, which the user must manage manually.