[Rd] Fortran coding standards

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 12 08:06:52 CEST 2007

On Wed, 11 Apr 2007, Vivek Rao wrote:

> --- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>> On Wed, 11 Apr 2007, Vivek Rao wrote:
> <snip>
>> Note that currently we expect only Fortran 77 to be used in R and 
>> (preferably) its packages, as there still are users with a Fortran 77 
>> compiler and nothing later.  One major group are those on Windows, and 
>> it is hoped that that will move to gcc 4.2.x in 2007.
> I don't understand this statement. Windows does not
> come with C or Fortran 77 compilers preinstalled,
> either. Windows binaries for the free Fortran 95
> compilers gfortran and g95 do exist, and I use them
> daily.

If you mean MinGW, they are private builds of unreleased versions. The 
actual maintainers do not recommend using them until their patches are 
incorporated (in gcc 4.2.0, to be released Real Soon Now).  I don't know 
of binaries of C, C++ and Fortran from a single source for gcc4 for MinGW, 
and you need a consistent set to build R and its packages.
(As you will see from the R-admin manual, I do use builds from unreleased 
versions to test that R will build (and have patched it so it does) in the 
hope that official builds will be available before 2.6.0 is released.)

MinGW builds of gfortran 4.x (or g95) are not compatible with MinGW gcc3 
in ways that can lead to incorrect calculations.

So there is nothing we can recommend to Windows users of R as yet, and 
there will not be while the R Windows binaries are built with gcc 3.4.5.

> <snip>
>> The Fortran code in R itself is (entirely, I think) imported from 
>> elsewhere, e.g. from EISPACK or LAPACK or Netlib. We have little 
>> interest in changing long-established code, and as the recent thread 
>> 'eigen in beta' shows, everytime we update such code someone thinks 
>> there is a new bug in R.
> That is understandable, but it also suggests that
> defects in code in contributed packages should be
> fixed
> before it is "published" and people start to rely on
> it.

Which is why we asked you to report such *to the maintainer* and not on R 

> The main benefit of the R project is the provision of
> working software to end users, who do not care about
> the style of the underlying C and Fortran code. A
> secondary benefit is that it provides a source of code
> for statistical algorithms that programmers can
> incorporate in their own programs. This audience will
> care about the quality of the code.

The R project is not responsible for the contributed packages, nor (as I 
and others have said) for the Fortran code shipped with R.
It is not even (strictly) responsible for CRAN.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list