Skip to content

Conversation

ravstrix
Copy link

No description provided.

@zeux
Copy link
Owner

zeux commented Oct 13, 2023

Can you share the motivation for this change?

@ravstrix
Copy link
Author

Because global constants have internal linkage, each .cpp file gets an independent version of the global variable. Using inline variables solves this problem by using external linkage for such variables. This ensures that only one instance of the variable exists in all files in which it is included.

@zeux
Copy link
Owner

zeux commented Oct 14, 2023

Sure - however, these are numeric constants with a literal initializer; clang doesn't emit any symbols here, and gcc doesn't emit any symbols with -O1 or higher. This would be different if the address of the variables is taken, but that should be highly unusual. So I am curious if this is motivated by a specific problem, or is more of a general cleanup.

@ravstrix
Copy link
Author

It's code cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants