Skip to content
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

[workspace] Reduce global variable constructor spam from VTK #22726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Mar 9, 2025

Drake's style guide forbids the use of global variable constructors and destructors. Merely loading a library should never execute any code (ditto for unloading / program shutdown). Code should bootstrap any necessary initialization the first time it runs; we mustn't let code that will never be run have effects elsewhere.

This doesn't fix all of the global variables yet, but it does fix many of them.

(Note that *.cc source files still have <iostream>. I have a separate work in progress that fixes <iostream> for all of our externals, but only in *.cc files. We need to evict iostream from header files before it can succeed.)


This change is Reviewable

Drake's style guide forbids the use of global variable constructors
and destructors. Merely loading a library should never execute any
code (ditto for unloading / program shutdown). Code should bootstrap
any necessary initialization the first time it runs; we mustn't let
code that will never be run have effects elsewhere.

This doesn't fix all of the global variables yet, but it does fix many
of them.
@jwnimmer-tri jwnimmer-tri added priority: low release notes: none This pull request should not be mentioned in the release notes labels Mar 9, 2025
@jwnimmer-tri
Copy link
Collaborator Author

+@BetsyMcPhail for feature review or delegation, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants