Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Comma operator in for() statements Date: Mon, 23 Mar 2020 13:16:45 -0700 Organization: None to speak of Lines: 24 Message-ID: <87a746rfma.fsf@nosuchdomain.example.com> References: <1bd094ifa4.fsf@pfeifferfamily.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="3e6b2f843d6dfd8c518c883b0a90e580"; logging-data="13040"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19S2+Jj+hlOz4GrkvwFTfF1" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:mtZcesvP5rjzzQDifepsyTxYffY= sha1:GC1B4xkLW5/NHXKki+/S3/MYkS8= Xref: csiph.com comp.lang.c:150777 Geoff writes: [...] > As for the comma operator, what does the standard have to say about > how the comma operator works in this context? Or in ANY context for > that matter? The standard says nothing about how the comma operator works in the context of a for loop, because there's nothing special to say about that context. What it says about the comma operator in general is: The left operand of a comma operator is evaluated as a void expression; there is a sequence point between its evaluation and that of the right operand. Then the right operand is evaluated; the result has its type and value. That's from N1570 6.5.17. N1570 is the most recent public draft of the C11 standard. You can get a copy from http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */