stdio line-streaming revisited

Sean Kelly sean at f4.ca
Thu Mar 29 16:15:16 PDT 2007


Frits van Bommel wrote:
> kris wrote:
>> Frits van Bommel wrote:
>>> Yes, call-chaining can only evaluate left-to-right, but the 
>>> parameters *passed* to the calls can be evaluated in any order.
>>
>> That's not at stake here, as far as I'm aware?
> 
> What I meant to say was that in 'Cout ("Hello, ") (Cin.get);' there's no 
> guarantee that Cin.get will evaluate before Cout("hello, "). (though it 
> _is_ guaranteed that sending that value to the output buffer will happen 
> after the string gets sent)

Oh right, this makes perfect sense.  In my original post I had meant the 
  order with respect to call chaining, not that Cin.get aberration ;-)

> Just because "Hello, " is somewhat unlikely to fill up the output buffer 
> right after a flush (as it was in the code sample in question) doesn't 
> mean it's okay to first output that and *then* ask for the name to put 
> after it. At least, IMHO.

Agreed.


Sean



More information about the Digitalmars-d mailing list