Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #86753

Re: C++ comma operator ?

From scott@slp53.sl.home (Scott Lurndal)
Subject Re: C++ comma operator ?
Newsgroups comp.lang.c++
References <th5sej$tqvo$1@dont-email.me> <th5tfi$u0ms$1@dont-email.me> <th5vqf$u4b9$1@redfloyd.dont-email.me> <TKDZK.110060$tRy7.36805@fx36.iad> <th7dva$3h5$1@gioia.aioe.org>
Message-ID <aj_ZK.97605$chF5.65591@fx08.iad> (permalink)
Organization UsenetServer - www.usenetserver.com
Date 2022-10-01 16:56 +0000

Show all headers | View raw


Lynn McGuire <lynnmcguire5@gmail.com> writes:
>On 9/30/2022 10:16 AM, Scott Lurndal wrote:
>> red floyd <no.spam.here@its.invalid> writes:
>>> On 9/29/2022 10:05 PM, James Kuyper wrote:
>>>> On 9/30/22 00:48, Lynn McGuire wrote:
>>>>> 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);
>>>>>
>>>>> There is a large open source template library supporting this statement
>>>>> from Fortran to C++ Fable software.
>>>>
>>>>
>>>>
>>>> If write, hkl, and f_calc are macros, you cannot be sure without
>>>> examining the macro definitions. However, if any of those three is an
>>>> ordinary function, it seems to me that this statement does unnecessarily
>>>> use the comma operator.
>>>>
>>>
>>> Not to mention that write() has an incorrect number of parameters,
>>> assuming POSIX.
>>>
>> 
>> The write here is an analog of the fortran write,
>> 
>>     WRITE unit,format,iolist
>> 
>> And yes, it will conflict with the Unix (and POSIX) write function signature.
>
>Yes, the Fortran write is "WRITE (unit, format) var1, var2, var3, etc..."
>    https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vnbs/index.html
>
>And yes, I am wondering if I will have to use the abhorrent "using 
>namespace fem;" statement to make sure that I get the correct write 
>function (which is no guarantee at all).  Or, if I will have to use 
>"fem::write".

Given C++ supports function signature overloads, I doubt you'll have
a problem with this in particular unless you only have a single element
iolist.   (note that in F77, there were no parentheses in the WRITE statement).

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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