Opened 6 years ago
Closed 5 years ago
#12901 closed Bugs (fixed)
time_point.hpp includes <iostream> header
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.65.0 | Component: | chrono |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Inclusion of <iostream> via inclusion chain causes static global variable being linked into every translation unit. It causes numerous atexit() calls at startup and the processing at finish. The reason is the trick used by all major C++ Standard library developers - putting an instance with static visibility somewhere in iostream header.
This is a minor performance issue, but it also hinders investigation of startup and exit defects in an application. When developer sets breakpoint in the atexit in C runtime library, there is a lot of noise from iostream if there are many cpp files in the application.
There are several affected files in boost.chrono that have <iostream> included:
io\duration_io.hpp io\time_point_units.hpp process_cpu_clocks.hpp time_point.hpp
The reason is not very clear. Please, at least include more specific header, like <ostream>, if really needed.
Change History (3)
comment:1 by , 5 years ago
Milestone: | To Be Determined → Boost 1.65.0 |
---|
comment:2 by , 5 years ago
Status: | new → assigned |
---|
comment:3 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
https://github.com/boostorg/chrono/commit/301adee6b8ea64ce27153b8d9ed4529b53e4c1b2