Hi,
I've done this. It does indeed seem to be a universal convention,
and it works on case insensitive file systems.
But your motivations don't persuade me that it has
significant advantages for Amber.
Here's the story. A long time ago, before the C preprocessor
was ubiquitous and when configuration interaction was still king
of the ab initio arts, the COLUMBUS programmers created cmdc.
cmdc enabled conditional Fortran compilation from master source
files so that one suite of COLUMBUS files could be distributed
on tape for IBM mainframes, Cray 1 supercomputers, etc.
:)
In 2005 we eliminated cmdc and leapfrogged over the C preprocessor
to compiler invoked Fortran preprocessors using .F, etc.
There have been very few problems; the problems i remember are
due to case insensitive file systems; and they have been fixable.
For example, our first attempt to implement a one file
approach for version info failed on mac's because we used a .f
intermediate file; we reworked it:
Makefile
--------
.PHONY: HEADWR
headwr.o: HEADWR
# Create headwr.inc to get the distribution version into headwr.F
HEADWR:
echo " distribution='"`cat ../../../doc/version`\' >headwr.inc
headwr.F
--------
p = program
v = version
include 'headwr.inc' ! this defines distribution.
write(unit, 100) p, v, distribution
100 format(//,
& 5x, '********************************************'/
& 5x, '** PROGRAM: ', 1x, a, 4x, '**'/
& 5x, '** PROGRAM VERSION: ', 1x, a, 4x, '**'/
& 5x, '** DISTRIBUTION VERSION:', 1x, a, 4x, '**'/
& 5x, '********************************************'/)
As far as Amber, I think the C preprocessor was used because
it was (almost?) ubiquitous and there was no Fortran equivalent.
I think the Fortran standard is still vague on preprocessor details,
but #ifdef, etc all work in practice.
I did the COLUMBUS conversion using simple unix commands,
and it was simple and error free.
But your (1) has never bothered me, and I doubt that (2) has
much gain (is it even measurable ?). (3) might be true, but
are we planning that change ?
scott
On Mon, Oct 10, 2011 at 03:43:43PM -0400, Ben Roberts wrote:
> On 10/10/2011, at 3:29 p.m., Tyler Luchko wrote:
> > 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.
>
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Thu Oct 13 2011 - 12:00:04 PDT