Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-02-16 11:35:55


On Tue, Feb 15, 2005 at 11:11:49PM -0500, Jason Hise wrote:

>
> From everything I know, cin, cout, cerr, and clog are simply global
> variables that live in namespace std. Does this mean that the following
> code is dangerous?
>
> class Log
> {
> public:
> Log ( ) { std::clog << "Log created\n"; }
> ~ Log ( ) { std::clog << "Log destroyed\n"; }
> } global_log;

The standard streams are meant to be available for users at any time.

Quite how implementations are supposed to achieve this isn't mandated:
http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#369

But I think the intention is that the code above is legal and safe.

See 27.3/2

jon


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk