Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Sequencing guarantees for macro versions of standard functions Date: Sun, 23 Jan 2022 23:50:33 -0800 Organization: None to speak of Lines: 34 Message-ID: <87mtjlo9me.fsf@nosuchdomain.example.com> References: <86k0euq62t.fsf@linuxsc.com> <87lez6xeld.fsf@nosuchdomain.example.com> <868rv5oldy.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="94b3a3008f708f7b40cdf3a125e51cf3"; logging-data="11858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186kmzQFum/mYRFtxRIdGU3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:I2WAIBsmeBEtR8fchKi3nK99ky8= sha1:OqLrbskuvYCLcxiYRlbX1azCwLI= Xref: csiph.com comp.lang.c:164571 Andrey Tarasevich writes: > On 1/23/2022 7:56 PM, Andrey Tarasevich wrote: >> On 1/23/2022 7:36 PM, Tim Rentsch wrote: >>> >>> However, the suggested rewrite has different semantics than the >>> previous single assignment with function call.  If we want to >>> keep the same semantics but still be able to use the macro >>> form (but without any sequencing issues), a different writing >>> is needed, as for example >>> >>>      x = modf( x, (double[]){ 0 } ); >>> >>> Writing the call this way should make it obvious that the value >>> stored in/through the second argument is ignored and discarded. >> That would be >>       x = modf( x, &(double[]){ 0 } ); >> > > Opps, my sitake. Sorry, I missed the `[]` part. > > Of course, your original variant is correct. Although I don't see the > point of bringing arrays into the picture. One can just do > > x = modf( x, &(double){ 0 } ); My preference would be: double ignored; x = modf(x, &ignored); -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */