< Talk:cpp‎ | io

it is always possible to write to std::cerr in user code - I think it's not true. Standard doesn't guarantee it: If it is possible for them to do so, implementations are encouraged to initialize the objects earlier than required. My point is: user can construct static object before std::cerr constructed and must guarantee that there is no calls to std::cerr inside constructor. But user can control order, by including <iostream> header.

Example: you can create static object in module A, without including <iostream>, call in constructor function from other module B, which call std::cerr operators (have include <iostream>). Depending on order of initialization, this may lead to segmentation fault, which can be fixed by including <iostream> in module A.

Ruslo 05:26, 19 August 2013 (PDT)

indeed, without <iostream>, there is no std::ios_base:Init, and this page (and cout/clog) doesn't mention that. I'll try to reword --Cubbi 06:57, 19 August 2013 (PDT)