问题
I have a Fortran 77 code that shows a comment in the first column and written double precision
in the same line. now my text editor (Notepad++) is showing that as a statement. I am confused if it is a statement or a comment.
* double precision Ct,Jt,PDt,AeA0t,Zt,Cq,Jq,PDq,AeA0q,Zq,
* &Kt,Kq,Eta,J,PD,AeA0
回答1:
It's a comment. If there's anything other than a whitespace in the first column of a line in a fixed-form fortran (That is Fortran up to F77), it's a comment.
These variables are not declared, but if the code doesn't have an implicit none
, they would be implicitly declared, some as REAL
, some as INTEGER
.
回答2:
First, the text editor syntax highlighting is not something you can trust 100%. It is just there to help you, but it can be wrong and it can differ from an editor to an editor.
Second, if that code compiles, it must be a comment. Otherwise the ampersand &
would cause an error. The ampersand can be used in the sixth column to continue the previous line, but it has to be the first character of the line.
来源:https://stackoverflow.com/questions/39423218/asterisk-and-fortran-statement