Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9274
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Subject | Re: cin - Why Does It Require 2 Returns? |
| Date | 2011-08-24 07:11 +0100 |
| Message-Id | <pan.2011.08.24.06.11.08.378000@nowhere.com> |
| Newsgroups | comp.lang.c++ |
| References | <MPG.28ba0eedf7623a239896c8@news.eternal-september.org> <9bbitnF5rnU1@mid.individual.net> <4e51f397$0$2861$7b1e8fa0@news.nbl.fi> <810bd50f-ddde-40ea-918c-5da951adbcff@a4g2000yqg.googlegroups.com> <4e535030$0$3087$7b1e8fa0@news.nbl.fi> |
| Organization | Zen Internet |
On Tue, 23 Aug 2011 07:01:04 +0000, Juha Nieminen wrote: > I don't think one should rely on the output of std::cout for debugging > purposes anyways. If adding debug prints, std::cerr should be used instead > of std::cout. std::cerr will flush after each *character* (ok, I don't know > if that's by standard, but at least the last time I checked with gcc it > does). This is of course horribly slow, but good for debugging. I'm not entirely sure how cout/cerr relate to stdout/stderr; however: ISO C requires that initially stderr is not fully buffered while stdout is fully buffered if and only if it can be determined not to refer to an interactive device. POSIX says the same thing, but the conventional Unix behaviour is that initially stderr is unbuffered, while stdout is line buffered if it refers to a tty and fully buffered otherwise. Note that "unbuffered" doesn't actually mean the same thing as "flush after each character"; the latter implies a write() per byte. Ultimately, "unbuffered" just means the stream doesn't have a persistent user-space buffer associated with it, so there's no way for a write operation on a stream to be deferred past the point that the function returns.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cin - Why Does It Require 2 Returns? mrc2323@cox.net (Mike Copeland) - 2011-08-20 20:49 -0700
Re: cin - Why Does It Require 2 Returns? Geoff <geoff@invalid.invalid> - 2011-08-20 21:12 -0700
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-21 17:21 +1200
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-21 17:20 +1200
Re: cin - Why Does It Require 2 Returns? Eugén Jung <contact@eugenjung.tk> - 2011-08-21 23:19 +0100
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-22 11:38 +1200
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-23 07:34 +1200
Re: cin - Why Does It Require 2 Returns? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-22 15:54 -0400
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-23 08:02 +1200
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-23 08:39 +1200
Re: cin - Why Does It Require 2 Returns? Ian Collins <ian-news@hotmail.com> - 2011-08-23 08:57 +1200
Re: cin - Why Does It Require 2 Returns? Paul <pchristor@yahoo.co.uk> - 2011-08-23 02:47 -0700
Re: cin - Why Does It Require 2 Returns? James Kanze <james.kanze@gmail.com> - 2011-08-26 08:07 -0700
Re: cin - Why Does It Require 2 Returns? James Kanze <james.kanze@gmail.com> - 2011-08-26 08:00 -0700
Re: cin - Why Does It Require 2 Returns? Juha Nieminen <nospam@thanks.invalid> - 2011-08-22 06:13 +0000
Re: cin - Why Does It Require 2 Returns? James Kanze <james.kanze@gmail.com> - 2011-08-22 10:49 -0700
Re: cin - Why Does It Require 2 Returns? Juha Nieminen <nospam@thanks.invalid> - 2011-08-23 07:01 +0000
Re: cin - Why Does It Require 2 Returns? Nobody <nobody@nowhere.com> - 2011-08-24 07:11 +0100
Re: cin - Why Does It Require 2 Returns? James Kanze <james.kanze@gmail.com> - 2011-08-26 08:12 -0700
csiph-web