stdio synching and startup code (was Re: segfaults after loading shared libstdc++)

Jason Merrill
Sun Jan 14 11:52:00 GMT 2001

>>>>> "Artem" == Artem Khodush <> writes:

> Predefined streams constructors are now called from
> basic_ios::Init::Init() is called from every user file that includes
> <iostream>.  There is no way to ensure that they will always be called in
> a particular order, so when someone somehow manages to build a program
> that calls basic_ios::Init::Init before the cin constructor, that
> constructor (cin(NULL)) will screw things up. The only way to (portably)
> cope with this is to make sure that all predefined streams constructors
> are really no-ops (which was proposed by the guy who reported this bug).

Agreed.  This is the point of Init.

And, BTW, of init_priority--which we might want to use on platforms that
support it, to avoid the overhead of imposing static constructors on all
object files that use iostream.


More information about the Libstdc++ mailing list