Opened 6 years ago

Closed 5 years ago

#12901 closed Bugs (fixed)

time_point.hpp includes <iostream> header

Reported by: Vyacheslav Lanovets <vyacheslav@…> 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:2 by viboes, 5 years ago

Status: newassigned

comment:3 by viboes, 5 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.