Skip to content

Conversation

@StephanTLavavej
Copy link
Member

When the STL's separately compiled code needs helper structs, we often define them in unnamed namespaces. This is simpler to understand (making it clear that the helpers are specific to one translation unit), and cleaner for static linking (unnamed namespaces now grant internal linkage).

I noticed a few things that weren't following this convention - the recently-added XFG trampoline, and the system_error tables. This PR moves the structs (and the tables) into top-level unnamed namespaces. It additionally removes static from the namespace-scope constexpr tables, as that's super redundant.

(We wouldn't need to use _STD for errc and _Execute_once_fp_t if these were unnamed namespaces within std. However, we appear to have generally avoided that, with the exception of some Concurrency::details::unnamed-namespace code.)

This does not attempt to move all such structs into unnamed namespaces; there some helper structs for iostreams that I consider way too scary to change.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Oct 24, 2020
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner October 24, 2020 03:29
@StephanTLavavej StephanTLavavej self-assigned this Oct 29, 2020
@StephanTLavavej StephanTLavavej merged commit f1faed9 into microsoft:master Oct 29, 2020
@StephanTLavavej StephanTLavavej deleted the unnamed_namespace branch October 29, 2020 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants