preprocessor token "#" doesn't work in gfortran as in gcc, intel-fortran or sun-fortran compiler
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Jun 10 21:55:00 GMT 2009
On Wed, Jun 10, 2009 at 11:38:01PM +0200, Maik Beckmann wrote:
> Steve Kargl schrieb am Mittwoch 10 Juni 2009 um 23:23:
>
> > -cpp with gfortran invokes the C preprocessor. gfortran does not
> > have a separate preprocessor designed to work with Fortran. You've
> > already hinted at the problem for Maik.
> >
> > troutmask:sgk[213] cat a.F90
> > print *, 'Hello' // ' world!'
> > end
> > troutmask:sgk[214] gfc4x -cpp -o z a.F90
> > troutmask:sgk[215] ./z
> > Hello world!
> > troutmask:sgk[216] cpp -std=c99 a.F90
> > # 1 "a.F90"
> > # 1 "<built-in>"
> > # 1 "<command-line>"
> > # 1 "a.F90"
> > print *, 'Hello'
> > end
>
> Thanks you for this explanations. This makes using the regular gcc cpp not
> an options for me, since I know this kind of // concats are used a lot in our
> code.
>
You can suppress the line numbering and stripping of the C99 comments
with -P and -C.
troutmask:sgk[204] cpp -P -C -std=c99 a.F90
print *, 'Hello' // ' world!'
end
I haven't looked into whether other problems exists. Tim might know.
--
Steve
More information about the Fortran
mailing list