Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #88428
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: best way to convert a Fortran implied do loop to C++ |
| Date | 2023-01-07 21:48 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87eds6hv8c.fsf@bsb.me.uk> (permalink) |
| References | <tpau9h$3e4fi$1@dont-email.me> <87k01yijwp.fsf@bsb.me.uk> <6NguL.537322$GNG9.514912@fx18.iad> |
Richard Damon <Richard@Damon-Family.org> writes:
> On 1/7/23 7:55 AM, Ben Bacarisse wrote:
>> Lynn McGuire <lynnmcguire5@gmail.com> writes:
>>
>>> So what is the best way to convert a Fortran implied do loop to C++ ?
>>>
>>> WRITE (2,2) (N (I), I = 1, 80)
>>> 2 FORMAT(' ',80A1)
>> Presumably the bounds are not always literals, and you probably also
>> want to general solution the works for multiple implied loops, some of
>> which might be nested? So not much!
>> My first question would be how you translate WRITE/FORMAT combinations
>> with no loops as that's going to form the basis of a solution.
>> (I presume you know Fortran well enough to know that this is not the
>> same as putting a loop round the
>
> Althogh in C++ you COULD put the loop around the write equivalent
> since C++ doesn't automatically take the first character as carriage
> control and add the new line to the end (if you use the right
> functions).
I would expect that with a clean translation the carriage control
handling (if wanted) would just come out in the wash. Even in modern
Fortran (where the "carriage control" malarkey is obsolete) you can't
just turn an implied loop into an explicit one. Presumably the
translating software already has some mechanism to iterate through the
format and that's what has to be driven by the implied loop.
If, as I suppose is possible, the first character is still to be treated
specially, that should just work out correctly as the code iterates
through the format.
--
Ben.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
best way to convert a Fortran implied do loop to C++ Lynn McGuire <lynnmcguire5@gmail.com> - 2023-01-06 23:00 -0600
Re: best way to convert a Fortran implied do loop to C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-07 12:55 +0000
Re: best way to convert a Fortran implied do loop to C++ Richard Damon <Richard@Damon-Family.org> - 2023-01-07 11:07 -0500
Re: best way to convert a Fortran implied do loop to C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-07 21:48 +0000
Re: best way to convert a Fortran implied do loop to C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-07 22:41 +0000
Re: best way to convert a Fortran implied do loop to C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-07 22:46 +0000
Re: best way to convert a Fortran implied do loop to C++ Lynn McGuire <lynnmcguire5@gmail.com> - 2023-01-07 21:29 -0600
Re: best way to convert a Fortran implied do loop to C++ Lynn McGuire <lynnmcguire5@gmail.com> - 2023-01-11 14:16 -0600
csiph-web