- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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:
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for yor response! which is this option? But, Is possilble the I using the fortran 90 options and I name as .for? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
FFLAGS=-openmp -O3 -traceback
the option -fixe or free?:
FFLAGS=-openmp -O3 -traceback -fixed
Thanks for your help
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Best!
-Udit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The ! form of comments will work regardless of fixed or free format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, Thanks for your help!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page