Deutsch English Français Italiano |
<v576d0$onl3$13@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: Richard Damon <richard@damon-family.org> Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: Can you please verify that the analysis of these C functions is correct? Date: Sat, 22 Jun 2024 14:50:08 -0400 Organization: i2pn2 (i2pn.org) Message-ID: <v576d0$onl3$13@i2pn2.org> References: <v4obkj$f9p5$2@dont-email.me> <v4pg5p$morv$1@raubtier-asyl.eternal-september.org> <v54s1p$3boc5$1@dont-email.me> <v5684p$3n50u$1@dont-email.me> <v56gs1$3olbi$3@dont-email.me> <v56lar$onl4$7@i2pn2.org> <v56uij$3rako$1@dont-email.me> <v57155$onl3$10@i2pn2.org> <v573g3$3s8q3$2@raubtier-asyl.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 22 Jun 2024 18:50:08 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="810659"; mail-complaints-to="usenet@i2pn2.org"; posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg"; User-Agent: Mozilla Thunderbird X-Spam-Checker-Version: SpamAssassin 4.0.0 Content-Language: en-US In-Reply-To: <v573g3$3s8q3$2@raubtier-asyl.eternal-september.org> Bytes: 2324 Lines: 21 On 6/22/24 2:00 PM, Bonita Montero wrote: > Am 22.06.2024 um 19:20 schrieb Richard Damon: > >> C++ made a special rule for the << operator because the gain for its >> use as an output was high enough, and the cost as a normal shift >> operator was rarely high (and normally hidden by the "as if" rule) so >> it was done there. > > I guess C++ doesn't make a statement on that and the ordered behaviour > depens in the cascaded return of the stream-object. My understanding is that the Standard made that a requirement so the cascaded operands would be computed in the right order. Prior to that, it was allowed to compute the order of the terms being output in any order, as the call to operator <<(ostream& strm, T& value) was allowd to compute value before resolving stream (as the value from the previous operator <<, which caught enough people off guard. That was considered useful enough, and where << is used as the shift operator, the restriction is unlikely to cause a large impact, so they did it for that special case.