Lynn McGuire <
lynnmc...@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.T...@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */