stdio line-streaming revisited
kris
foo at bar.com
Thu Mar 29 15:38: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)
> 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.
Yes, I agree. Call chaining is always left to right, though; it's just
not written down in the spec at this time (along with several other things?)
I don't think anyone ever said that it was good practice to rely on some
implementation idiom. The fact that this operates is merely interesting,
and not something to start a war over ;-)
More information about the Digitalmars-d
mailing list