Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #9195

Re: cin - Why Does It Require 2 Returns?

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: cin - Why Does It Require 2 Returns?
Date 2011-08-22 15:54 -0400
Organization A noiseless patient Spider
Message-ID <j2uc5a$tpc$1@dont-email.me> (permalink)
References (2 earlier) <j2s0aq$dp2$1@dont-email.me> <9bdj8eFr0aU3@mid.individual.net> <flushing-20110822202017@ram.dialup.fu-berlin.de> <9bfpasFs5qU1@mid.individual.net> <growth-20110822214337@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 8/22/2011 3:45 PM, Stefan Ram wrote:
> Ian Collins<ian-news@hotmail.com>  writes:
>> Until the program grows and the user wonders why the line does not appear.
>
>    A: »Why should I use X in this program?«
>    B: »You do not actually need it in this program.
>       But if you would write another program, you would need it.
>       So you'd better start using it right now, should your
>       program ever be changed somehow into that other program.«
>
>    A: »Why should I take the drug X?«
>    B: »Well you do not need it right now. But if you ever should
>       develop the condition S, you would need it. Therefore, you
>       should better start to take it now, so that you will not
>       forget to take it, if you ever develop that condition.
>       Even, if the drug makes your movements become
>       a little bit slower now.«
>

To summarise all recommendations, in a debug version every output should 
be followed by a flush (otherwise the output can be lost when debugging 
with breakpoints or due to a crash), and any time the designer of the 
program expects the user to want to see the output, some kind of flush 
needs to happen, especially when the user input is required.  Correct? 
The latter is often taken care of by synchronising intput and output. 
And the former could be done based on timer.

For debugging, some kind of built-in automatic flushing after every 
output would be very handy.  OTOH, when debugging I/O buffering one 
should explicitly disable the automatic flushing...

Any other times when a flush would be necessary or ill-advised?

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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