Re: coding style: do/exit or do while ?
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Mon, 07 Aug 2006 09:23:46 -0700
dpb wrote:
(snip regarding DO and WHILE loops)
And, of course, where amax and bmax are both external to the loop and
don't change (as I know they were postulated as constants here). But
oftentimes one will see the construction tried to be used where it
doesn't fit when one of the conditions is changing based on loop
execution and the test then is misplaced in the logic flow. Avoiding
this, I presume, is the prime reason for the proscription although I'm
fond of the "never say 'never' " dictum.
For those converting C to Fortran, the test in a C for loop is done
using the current values, and they can change. One should be careful:
for(i=1;i<=n;i++)
n can legally change inside the loop, and so might not translate to a
Fortran DO loop.
-- glen
.
- References:
- coding style: do/exit or do while ?
- From: Daniel Franke
- Re: coding style: do/exit or do while ?
- From: glen herrmannsfeldt
- Re: coding style: do/exit or do while ?
- From: dpb
- coding style: do/exit or do while ?
- Prev by Date: Re: backspace error (reading file from the end)
- Next by Date: Re: Different results on two clusters
- Previous by thread: Re: coding style: do/exit or do while ?
- Next by thread: Re: coding style: do/exit or do while ?
- Index(es):
Relevant Pages
|