[CMake] Compiling fortran

Arjen Markus arjen.markus at wldelft.nl
Thu Sep 27 02:14:57 EDT 2007


Juan Sanchez wrote:

>Anyone know what are the valid comment lines in all the Fortran variants?
>
>I know of lines beginning with c, C, or * in the first column.
>
>  
>
Those are valid only in the fixed-form type of source code.
The exclamation mark (!) is valid in both free-form and fixed-form code 
(from
Fortran 90 onwards, but perhaps there are FORTRAN 77 compilers out there
that accepted that as well).

The exclamation mark, appearing anywhere _outside_ a literary string, marks
the beginning of a comment. I do not think it would cause any problems
to assume any exclamation mark (even inside a string) is the start of a 
comment
- for this particular task: you can not have a valid USE statement follow a
literary string.

Another problem is, however, the D (and d) conditional comment (only for
fixed form). It is regarded a comment during normal compilation, but may
be turned into valid code with a compile option. Probably the safest bet
here is to assume that it is always valid code:

C
C Only use this module if we are debugging ...
D         use my_debugging_stuff
C
C
C
D         call debug_msg( 'Now in routine such-and-such' )

Regards,

Arjen



More information about the CMake mailing list