Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86741
| Path | csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: C++ comma operator ? |
| Date | Fri, 30 Sep 2022 12:41:54 -0700 |
| Organization | None to speak of |
| Lines | 37 |
| Message-ID | <871qrsmyyl.fsf@nosuchdomain.example.com> (permalink) |
| References | <th5sej$tqvo$1@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | reader01.eternal-september.org; posting-host="1f38438657dd3db62687cfe8b0c17bab"; logging-data="1156681"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mABltha5ZCRokE5XQKMJ+" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
| Cancel-Lock | sha1:IrfKPl+2FfW88RbGcBR9TDs/OK4= sha1:KQolD+spsz43ahxCYT9Ur7BuHEg= |
| Xref | csiph.com comp.lang.c++:86741 |
Show key headers only | View raw
Lynn McGuire <lynnmcguire5@gmail.com> writes:
> Is this C++ statement using the comma operator ?
>
> write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"), hkl(1, i), hkl(2, i),
> hkl(3, i), f_calc(1, i), f_calc(2, i);
Yes, five of them, easily seen by reformatting the code:
write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"),
hkl(1, i),
hkl(2, i),
hkl(3, i),
f_calc(1, i),
f_calc(2, i);
Assuming there's no macro funny business going on, that's 6 function
calls (or macro invocations?) separated by comma operators. (The commas
separating function arguments are of course not comma operators.)
Replacing the comma at the end of each line by a semicolon (and possibly
surrounding the whole thing with curly braces) yields equivalent code.
The braces are needed if the context is something like:
if (condition)
write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"), hkl(1, i), hkl(2, i),
hkl(3, i), f_calc(1, i), f_calc(2, i);
Things might change if any of write, hkl, and f_calc is a macro. If
they're well behaved macros, it shouldn't matter.
> There is a large open source template library supporting this
> statement from Fortran to C++ Fable software.
--
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 */
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-29 23:48 -0500
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 00:01 -0500
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 00:03 -0500
Re: C++ comma operator ? James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-09-30 01:05 -0400
Re: C++ comma operator ? red floyd <no.spam.here@its.invalid> - 2022-09-29 22:45 -0700
Re: C++ comma operator ? scott@slp53.sl.home (Scott Lurndal) - 2022-09-30 15:16 +0000
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 13:53 -0500
Re: C++ comma operator ? Gawr Gura <gawrgura@mail.hololive.com> - 2022-09-30 13:17 -0700
Re: C++ comma operator ? scott@slp53.sl.home (Scott Lurndal) - 2022-10-01 16:56 +0000
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-01 13:13 -0500
Re: C++ comma operator ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-10-03 02:32 -0700
Re: C++ comma operator ? Juha Nieminen <nospam@thanks.invalid> - 2022-10-03 10:48 +0000
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 13:32 -0500
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-01 14:30 -0500
Re: C++ comma operator ? James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-10-02 16:08 -0400
Re: C++ comma operator ? Manfred <noname@add.invalid> - 2022-10-01 01:03 +0200
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 23:09 -0500
Re: C++ comma operator ? Gawr Gura <gawrgura@mail.hololive.com> - 2022-09-29 23:19 -0700
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 13:31 -0500
Re: C++ comma operator ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-30 12:41 -0700
Re: C++ comma operator ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-10-03 02:38 -0700
Re: C++ comma operator ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-09-30 23:48 -0500
csiph-web