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

158. Underspecified semantics for setbuf()

Section: [streambuf.virt.buffer] Status: TC1 Submitter: Dietmar Kühl Opened: 1999-07-20 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [streambuf.virt.buffer].

View all issues with TC1 status.


The default behavior of setbuf() is described only for the situation that gptr() != 0 && gptr() != egptr(): namely to do nothing. What has to be done in other situations  is not described although there is actually only one reasonable approach, namely to do nothing, too.

Since changing the buffer would almost certainly mess up most buffer management of derived classes unless these classes do it themselves, the default behavior of setbuf() should always be to do nothing.

Proposed resolution:

Change [streambuf.virt.buffer], paragraph 3, Default behavior, to: "Default behavior: Does nothing. Returns this."