do while: most elegant or efficient

From: Oyvind Sylta (oyvind.sylta_at_iku.sintef.no)
Date: 01/24/05


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



Relevant Pages

  • Re: Multithreading on Multicore Processors
    ... I have an installation of Intel Fortran v9.something on my Windows XP ... the compiler, linker etc. ... The easy way to meet your goals is with OpenMP. ...
    (comp.lang.fortran)
  • Re: Introducing the Intel(R) Fortran Compiler, Standard and Professional Editions, for Mac OS*
    ... platforms would be a bit less than buying ... That would encourage Intel Fortran users on one ... I just bought Tecplot for Linux, and negotiated a concurrent license to run it under Windows too. ...
    (comp.lang.fortran)
  • Re: ifort and CVF
    ... > I have CVF 6.6 and my employer has a licence for Intel Fortran. ... > change is a clear performance improvement in solving flow problems using ... are running on a suitable platform, ...
    (comp.lang.fortran)
  • Re: extended precision
    ... > Why dont you just upgrade CVF to its successor release ... > Until March you can upgrade for $200 if your CVF is current. ... The Intel Fortran still requires the addition of a Microsoft C++ ...
    (comp.lang.fortran)
  • Re: decimal to binary
    ... > Can I read between the lines of this post to conclude that Intel Fortran ... > "CVF is dead! ... haven't migrated to IVF en masse, if only because IVF has yet to match CVF. ...
    (comp.lang.fortran)