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


Groups > comp.lang.java.programmer > #33341

Re: method parameter binding

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: method parameter binding
Date 2015-12-10 18:00 +0000
Organization A noiseless patient Spider
Message-ID <n4cejp$qdp$1@dont-email.me> (permalink)
References (2 earlier) <n4c8dt$kki$1@news.albasani.net> <n4c8q6$lev$1@news.albasani.net> <n4c957$m15$1@news.albasani.net> <n4c96k$m15$2@news.albasani.net> <n4c9gj$luo$2@dont-email.me>

Show all headers | View raw


On Thu, 10 Dec 2015 11:35:48 -0500, Eric Sosman wrote:

>      Could it be that System.out and System.err are two different
> and independent PrintStreams, each with its own buffering and making its
> own decisions about when to flush buffers?
> 
>      Naaah, too simple ...
>
That's certainly the case in the UNIX/Linux world, where stdout, which 
System.out maps to, is quite extensively buffered while stderr, which 
System.err uses, is unbuffered. 

Normally it all works as expected if you only use stdout or stderr, but 
use both, e.g. for debugging, and the actual output from mixed stdout and 
stderr print statements does not necessarily appear in the same order as 
the statements were executed. As Jan says, this can be confusing, 
especially if you're capturing the output in a single stream using 
something like:

   myprog 2>&1 |less 

because you know the output is much bigger than one screen's worth and 
you want to search it or page through it using the 'less' utility.
 
Similarly, in C you can output a prompt with fprintf(stderr, "....") and 
follow it immediately with a read to get user input, but if you used print
("....") or fprintf(stdout, "....") you need to call fflush(stdout) to 
make sure the prompt has been displayed before attempting to read the 
user input.

I don't recall whether Windows does the same.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

method parameter binding Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2015-12-10 07:44 -0800
  Re: method parameter binding Eric Douglas <e.d.programmer@gmail.com> - 2015-12-10 07:53 -0800
    Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:14 +0100
      Re: method parameter binding Eric Douglas <e.d.programmer@gmail.com> - 2015-12-10 08:20 -0800
        Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:23 +0100
          Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:23 +0100
      Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:21 +0100
        Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:27 +0100
          Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 17:28 +0100
            Re: method parameter binding Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-10 11:35 -0500
              Re: method parameter binding Martin Gregorie <martin@address-in-sig.invalid> - 2015-12-10 18:00 +0000
          Re: method parameter binding Eric Douglas <e.d.programmer@gmail.com> - 2015-12-10 08:41 -0800
            Re: method parameter binding j4n bur53 <janburse@fastmail.fm> - 2015-12-10 19:29 +0100
  Re: method parameter binding Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-10 11:33 -0500
  Re: method parameter binding Jan Burse <janburse@fastmail.fm> - 2015-12-10 22:34 +0100
    Re: method parameter binding Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-10 17:09 -0500
      Re: method parameter binding j4n bur53 <janburse@fastmail.fm> - 2015-12-11 09:27 +0100

csiph-web