Skip to content

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

Merged
chapulina merged 1 commit intogazebosim:mainfrom
jwnimmer-tri:iostream-narrower-include
Nov 23, 2021
Merged

Use <ostream> and <istream> narrower includes, not <iostream>#287
chapulina merged 1 commit intogazebosim:mainfrom
jwnimmer-tri:iostream-narrower-include

Conversation

@jwnimmer-tri
Copy link
Copy Markdown
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 <jeremy.nimmer@tri.global>
Copy link
Copy Markdown
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.

5 participants