Question on library issue #581, using a sentry in flush()
  Home FAQ Contact Sign in
Your Ad Here
comp.lang.c++.moderated only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.c++.moderated Profile…

 Up
Question on library issue #581, using a sentry in flush()         


Author: Bo Persson
Date: May 2, 2008 02:50

This would have gone to comp.std.c++, had it been active.

The resolution to issue 581

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2578.html#581

requires that basic_ostream::flush creates a sentry object to verify
the stream state.

However, for streams with the unit_buf flag set, like std::err, the
destructor of the sentry object will again call flush(). This seems to
create an infinite recursion for

std::cerr << std::flush;

or even

std::cerr << "Some message" << std::endl;

Have I missed something here?

Bo Persson

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
4 Comments
Re: Question on library issue #581, using a sentry in flush()         


Author: Francis Glassborow
Date: May 2, 2008 10:50

Bo Persson wrote:
> This would have gone to comp.std.c++, had it been active.

Is it possible to find out what happened to comp.std.c++? Even better
would be to revive it as it provided an important and useful service
(and as we get closer to C++0x, it becomes more important to have a
newsgroup that deals with standard issues rather than coding ones)

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
no comments
Re: Question on library issue #581, using a sentry in flush()         


Author: Daniel Krügler
Date: May 3, 2008 04:20

On 2 Mai, 12:43, "Bo Persson" wrote:
> The resolution to issue 581
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2578.html#581
>
> requires that basic_ostream::flush creates a sentry object to verify
> the stream state.
>
> However, for streams with the unit_buf flag set, like std::err, the
> destructor of the sentry object will again call flush(). This seems to
> create an infinite recursion for
>
> std::cerr << std::flush;
>
> or even
>
> std::cerr << "Some message" << std::endl;
>
> Have I missed something here?
Show full article (1.05Kb)
no comments
Re: Question on library issue #581, using a sentry in flush()         


Author: sebor
Date: May 8, 2008 20:43

On May 3, 6:13 am, Daniel Krügler googlemail.com>
wrote:
> On 2 Mai, 12:43, "Bo Persson" wrote:
>
>
>
>> The resolution to issue 581
>
>
>> requires that basic_ostream::flush creates a sentry object to verify
>> the stream state.
>
>> However, for streams with the unit_buf flag set, like std::err, the
>> destructor of the sentry object will again call flush(). This seems to
>> create an infinite recursion for
>
>> std::cerr << std::flush;
>
>> or even ...
Show full article (1.60Kb)
no comments
Re: Question on library issue #581, using a sentry in flush()         


Author: Daniel Krügler
Date: May 9, 2008 19:31

On 9 Mai, 05:43, "se...@roguewave.com" roguewave.com> wrote:
> The text in [ostream::sentry], p4 should probably be changed
> to read something like
>
> If ((os.flags() & ios_base::unitbuf) && !uncaught_exception())
> is true, calls os.rdbuf()->pubsync().
>
> to avoid this. Let me fix it along with the similar problem
> with the tied stream.

I agree with this..
> I think the numbers have changed between C++ 98 and the latest
> working paper. We should be using section names instead of
> numbers, they don't change (i.e., [ostream.unformatted]).

You are right in both points, as I just notice.

Let me add three related questions, which came to me while
I was searching of references to flush:
Show full article (2.25Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: To flush or not to flush...rec.motorcycles.harley ·
Re: flush or not to flushrec.autos.tech ·