do while: most elegant or efficient
From: Oyvind Sylta (oyvind.sylta_at_iku.sintef.no)
Date: 01/24/05
- Next message: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Previous message: Georgios Petasis: "Re: Calling C from Fortran link problems (Compaq Visual Fortran 6.6 & MS Visual Studio 8)..."
- Next in thread: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Reply: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Reply: Pierre Asselin: "Re: do while: most elegant or efficient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 Jan 2005 12:29:40 +0100
In CVF the following works fine, while in Intel Fortran (Windows) it does
not:
character c*5
max=5
a='bcdef'
n=1
do while(n.lt.max.and.c(n:n).ne.'a')
n=n+1
enddo
I guess a correct way to write the while-loop would be:
do while(n.lt.max)
if(c(n:n).ne.'a') n=n+1
enddo
However, what is the most efficient and elegant (?) way of writing this in
Fortran95? Is there a penalty in performance by splitting the while into a
while & if combination? What about other compilers?
Oyvind
- Next message: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Previous message: Georgios Petasis: "Re: Calling C from Fortran link problems (Compaq Visual Fortran 6.6 & MS Visual Studio 8)..."
- Next in thread: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Reply: beliavsky_at_aol.com: "Re: do while: most elegant or efficient"
- Reply: Pierre Asselin: "Re: do while: most elegant or efficient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|