Re: do while: most elegant or efficient
beliavsky_at_aol.com
Date: 01/24/05
- Next message: Arjen Markus: "Re: Calling C from Fortran link problems (Compaq Visual Fortran 6.6 & MS Visual Studio 8)..."
- Previous message: Oyvind Sylta: "do while: most elegant or efficient"
- In reply to: Oyvind Sylta: "do while: most elegant or efficient"
- Next in thread: Oyvind Sylta: "Re: do while: most elegant or efficient"
- Reply: Oyvind Sylta: "Re: do while: most elegant or efficient"
- Reply: Richard E Maine: "Re: do while: most elegant or efficient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Jan 2005 03:55:04 -0800
In your code, perhaps the LHS of
a = 'bcdef'
should have been variable c, which is otherwise not set. One can find
the first occurrence of 'a' in string c with
n = index(c,"a")
The reason the first code may not work is that according to the Fortran
standard, the second conditional involving c(n:n) may be evaluated
before the first one is, resulting in trying to access an out-of-bound
element of c. If there were no "index" function, I would probably use a
DO loop with an EXIT, although I don't know if it is faster.
- Next message: Arjen Markus: "Re: Calling C from Fortran link problems (Compaq Visual Fortran 6.6 & MS Visual Studio 8)..."
- Previous message: Oyvind Sylta: "do while: most elegant or efficient"
- In reply to: Oyvind Sylta: "do while: most elegant or efficient"
- Next in thread: Oyvind Sylta: "Re: do while: most elegant or efficient"
- Reply: Oyvind Sylta: "Re: do while: most elegant or efficient"
- Reply: Richard E Maine: "Re: do while: most elegant or efficient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|