This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

178. Should clog and cerr initially be tied to cout?

Section: 31.4.3 [narrow.stream.objects] Status: NAD Submitter: Judy Ward Opened: 1999-07-02 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [narrow.stream.objects].

View all issues with NAD status.

Discussion:

Section 27.3.1 says "After the object cerr is initialized, cerr.flags() & unitbuf is nonzero. Its state is otherwise the same as required for ios_base::init (lib.basic.ios.cons). It doesn't say anything about the the state of clog. So this means that calling cerr.tie() and clog.tie() should return 0 (see Table 89 for ios_base::init effects).

Neither of the popular standard library implementations that I tried does this, they both tie cerr and clog to &cout. I would think that would be what users expect.

Rationale:

The standard is clear as written.

27.3.1/5 says that "After the object cerr is initialized, cerr.flags() & unitbuf is nonzero. Its state is otherwise the same as required for ios_base::init (27.4.4.1)." Table 89 in 27.4.4.1, which gives the postconditions of basic_ios::init(), says that tie() is 0. (Other issues correct ios_base::init to basic_ios::init().)