preprocessor token "#" doesn't work in gfortran as in gcc, intel-fortran or sun-fortran compiler

Tim Prince TimothyPrince@sbcglobal.net
Wed Jun 10 16:42:00 GMT 2009


Tobias Schlüter wrote:

> Maik Beckmann wrote:
>> Why does gfortran -cpp" behave different than gcc or any other fortran
>> compiler I have around?  Is this by intention or just a bug?
> 
> gfortran's preprocessor uses traditional C preprocessing rules, which
> differ from what was standardized in C90 in regards to token pasting and
> stringification.  There may be a command line option to change this
> behavior (I don't know), and it may make sense to revise that decision
> if all other compilers behave differently.
> 
> Cheers,
> - Tobi
As far as I know, gfortran, and later versions of g77, invoke tradcpp, the
same as 'gcc -traditional' does.  tradcpp doesn't support C99 or C++, and
doesn't break Fortran string concatenation.  In order to support
installations where the default gnu Fortran version is likely to be broken
(or the name of it varies), some of my customers use the 'gcc -traditional
-x c' command to pre-process .F
The gcc maintainers decided to support the distinctions by providing the
separate tradcpp.



More information about the Fortran mailing list