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

Use <ostream> and <istream> narrower includes, not <iostream> #287

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

jwnimmer-tri
Copy link
Contributor

@jwnimmer-tri jwnimmer-tri commented Nov 23, 2021

🦟 Bug fix

Summary

The use of <iostream> induces global constructors in every translation unit to initialize std::cout and std::cerr. We shouldn't do that unless we're actually going to use std::cout or std::cerr.

Reference: https://en.cppreference.com/w/cpp/header/iostream

Checklist

  • Signed all commits for DCO
  • Added tests (N/A)
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing) -- no new errors; the 9 errors on the main branch are also reported on this PR.
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

The use of <iostream> induces global constructors in every translation unit to
initialize cout and cerr.  We shouldn't do that unless we're actually going to
use cout or cerr.

Signed-off-by: Jeremy Nimmer <[email protected]>
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@chapulina chapulina merged commit c453880 into gazebosim:main Nov 23, 2021
@jwnimmer-tri jwnimmer-tri deleted the iostream-narrower-include branch November 23, 2021 20:00
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.

3 participants