Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: is "x *= ++f * ++f" a valid statement ? Date: Mon, 22 Jul 2024 14:58:14 -0700 Organization: None to speak of Lines: 14 Message-ID: <87bk2pgkcp.fsf@nosuchdomain.example.com> References: <96127c8d8d204b7c3230828101bc2b6e@www.novabbs.org> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 22 Jul 2024 23:58:15 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2dbbd0a9bdf342ec09be1b64688be2d7"; logging-data="888484"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aDjI2kdKr8wTSf5E+F64s" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:fIB/N/BIgp99PzQX/Tuivp9x194= sha1:5b/o/a+qNUF/vcY4AhK0aloI+k4= Xref: csiph.com comp.lang.c++:119717 what@tf.com (testuseri2p) writes: > I'd say in simple words, if you alter a variable multiple times in one > statement, you get UB. That's a little too simple. You can alter a variable multiple times in one statement as long as the two modifications are *sequenced*, for example if they're separated by a comma operator. In the code fragment in the subject line, the two occurrences of "++f" are unsequenced, so the behavior is undefined. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */