在 2018年07月10日 19:28, Klaus Rudolph 写道:
Is it a bug, that every function emmits a exact copy for calling std::ios_base::Init::Init()@plt ? It is only needed once but emmited for each function. This wastes a lot of program space. In addition for my example, I removed the call to my functions so there is no place anymore where I need iostream operations. But the code is still present, also if the requiring functions are not linked in.
No. According to the C++ standard, inclusion of <iostream> shall behave as if an object of type `std::ios_base::Init` and with static storage duration is defined [1], which results in a constructor call in every translate unit that has `#include <iostream>`.
[1] https://en.cppreference.com/w/cpp/io/ios_base/Init -- Best regards, LH_Mouse