Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Comments

felipin85
ビギナー
3,543件の閲覧回数
Hi everybody! I like make a question of curiosity. I normaly do the comments in fortran 95/90 with "!", but I read in Intel Fortran Programmers Reference that I can create a comment with "C or c",with "*" and with "#", but I try in hola.f90, and I get the following errors:


Estoy compilando, tardo un ratn...
hola.f90(2): error #5082: Syntax error, found IDENTIFIER 'THIS' when expecting one of: ( % [ : . = =>
C THIS IS A COMMENT
--^
hola.f90(3): error #5082: Syntax error, found '*' when expecting one of:
0 件の賞賛
1 解決策
Steven_L_Intel1
従業員
3,543件の閲覧回数
Please do not use -fixed or -free. Instead, rename the source file to have the .f90 file type if it is free-form source, or .f or .for if it is fixed-form source.

You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.

I strongly recommend the use of free-form source in all new development.

元の投稿で解決策を見る

10 返答(返信)
John4
高評価コントリビューター I
3,543件の閲覧回数

The .f90 extension (and .f95, .f2k, .f03, .f08, ...) is usually associated to free-form source files, and therefore only "!" is allowed to indicate the beginning of a comment (anywhere between columns 1 and 132).

The fixed-form source files (which usually have extensions .f, .for, .f77, .ftn, ...) allow "C" or "*" but only in the first column. Fixed-form files also allow "!" anywhere between columns 1 and 5 and between columns 7 and 72.

The compiler will let you put "!" after column 132 (in free-form) or after column 73 (in fixed form), but some extra flags might be required and it's not a portable solution.

felipin85
ビギナー
3,543件の閲覧回数
I was surprised it did not work because I read in the guide intel fortran. It's a shame, because I would have liked to reuse code that I have on. for or. f77 and change them. f90.
TimP
名誉コントリビューター III
3,543件の閲覧回数
If you want to use fixed form input with .f90 file name, there is an option for that, but the usual way is to continue to use those file names with .f or .for suffixes.
felipin85
ビギナー
3,543件の閲覧回数
Thanks for yor response! which is this option? But, Is possilble the I using the fortran 90 options and I name as .for? Thanks
Udit_P_Intel
従業員
3,543件の閲覧回数
I think that you can use -fixed and -free options to specifically tell the compiler that the program is Fixed Form (F77 style) and Free Form (F90 and later) respectively. Unless I am missing something, these options will override the extension of the filename.
felipin85
ビギナー
3,543件の閲覧回数
Ok, then I must add in the makefile in the line:

FFLAGS=-openmp -O3 -traceback

the option -fixe or free?:

FFLAGS=-openmp -O3 -traceback -fixed


Thanks for your help

Regards
Udit_P_Intel
従業員
3,543件の閲覧回数
You should add -fixed in the makefile. This will enable a .f90 file to be treated in fixed form. In other words, your original code should work without the syntax error with this option.

Best!
-Udit
TimP
名誉コントリビューター III
3,543件の閲覧回数
The ! form of comments will work regardless of fixed or free format.
Steven_L_Intel1
従業員
3,544件の閲覧回数
Please do not use -fixed or -free. Instead, rename the source file to have the .f90 file type if it is free-form source, or .f or .for if it is fixed-form source.

You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.

I strongly recommend the use of free-form source in all new development.
felipin85
ビギナー
3,543件の閲覧回数
Ok, Thanks for your help!
返信