Re: [AMBER-Developers] updating Fortran files to .F/.F90

From: Tyler Luchko <tluchko.rci.rutgers.edu>
Date: Mon, 10 Oct 2011 16:07:54 -0400

On 10/10/2011 03:43 PM, Ben Roberts wrote:
> Hi Tyler,
>
> On 10/10/2011, at 3:29 p.m., Tyler Luchko wrote:
>
>> Hello Everyone,
>>
>> At the last developers meeting I proposed changing our Fortran file
>> naming scheme from the generic '.f' to using '.F' for fixed format,
>> pre-processed files, '.F90' for free format, pre-processed files and
>> '.f' for fixed format files without pre-processing. As a result of this
>> name change explicit calls to the C pre-processor would be removed and
>> the compiler's built in pre-processor would automatically be called.
>>
>> The motivation for this change is:
>>
>> 1) Easier debugging as line numbers refer to the original source file
>> and not an intermediate.
>>
>> 2) Eliminating intermediate files reduces clutter, disk space and,
>> possibly, compile time.
>>
>> 3) This is a universal convention (though not part of an official
>> standard) and has been in use for over a decade by many compilers. If
>> we choose to move to a different build system (e.g. cmake) this will
>> also help ease the transition.
>
> I like this idea. In fact, I started doing something similar myself a while ago, but at the time Dave Case argued against it. My motivation was by no means as strong an argument as yours; I was simply sick of my syntax-aware editors highlighting the free-format F90 source files as if they were fixed-format F77.
>
> There is one thing that you can perhaps clarify for us. Will this in any way change the syntax needed for #ifdef declarations and the like? And are there any disadvantages to using the Fortran preprocessor instead of the C preprocessor? I gather there is some reason why we've been explicitly asking for a C preprocessor instead of relying on the Fortran compiler's preprocessor; perhaps this reason is purely historical, though.
>

The short answer is that with the compilers that I have been able to
test, GNU, Intel and PGI, everything works without modification. I
would _expect_ this to be true for other common compilers as the
convention is to use the C pre-processor, or something very close to it,
but don't have the machines/compilers to test this.

The long answer is different compilers do invoke different
pre-processors. GNU, PGI and IBM invoke the C pre-processor. Intel, Sun
and NAG have Fortran pre-processors that obey common C pre-processor
directives and syntax but are not identical to cpp. For example,
Intel's fpp does not support #pragma or #ident. As I said, of this last
group I've only used Intel and had no problems with the current code.

Tyler

_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Mon Oct 10 2011 - 13:30:03 PDT
Custom Search