Neil Carlson wrote:
> Has there been any effort in the standardization committee to add the
> stringify (#)
> and concatenation (##) operators to the Fortran preprocessor
> specification?
There is no Fortran preprocessor specification. Except for conditional
compilation, which is Part 3 of the Fortran (95) standard (ISO/IEC
1539-3:1999), cf. http://www.iso.org/iso/catalogue_detail?csnumber=29926
. It has very little user and the only implementation seems to be Coco,
http://users.erols.com/dnagle/coco.html
What you mean is the C preprocessor as defined in the C standard. Newer
versions of those provide ## for concatenation. The C preprocessor has
become the de-facto preprocessor for Fortran, but that's really beyond
standardization.
> These are perhaps a fringe capability, but useful and with no
> substitute in some
> circumstances. I've long wanted # to be able to print the condition
> in assertions,
> and have just encountered a situation that calls for ##.
> Intel's fpp support these; gfortran and NAG do not. I don't know what
> other
> compilers do. Or do most people just use the C preprocessor (I'm assuming
> # and ##, if not part of the standard, are more universally supported
> there) and
> cope with the Fortran-ignorant issues it introduces?
The problem with newer CPP features is that they badly handle certain
Fortran constructs like strings, continuation lines, ' in comments ("!
It's ...") etc. Thus, a preprocessor has to be aware of Fortran in order
to support it.
I think NAG uses fdfpp from http://netlib.org/fortran/, which is no
longer updated.
gfortran uses GCC's CPP (libcpp) but in the traditional mode. For
gfortran, supporting newer features is planed - after a Fortran mode for
libcpp has been added. See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28662 - However, it is
unclear when it will be implemented. (gfortran is nearly exclusively
developed by volunteers.) If you know someone who might be interested to
work on it, it will speed things up. [Side note: Via Google Summer of
Code 2013, students get paid for working on open-source projects. If you
know an undergraduate to Ph.D. student, who wants to work on gfortran,
you could suggest this as project.]
Tobias
|