Fortran Fortran compiler specific kind modifier.

  • Thread starter uart
  • Start date

uart

Science Advisor
2,776
9
Fortran compiler specific "kind" modifier.

I've recently switched over from the SilverFrost (Salford) FTN95 compiler to the open source g95 compliler. So far everything seems very compatible between the two compilers (as in the same source compiles without modification on either compiler) except for one thing. The "kind" specifier in the Silverfrost implementation seems to be different to that of the g95 implementation.

In the SF ftn95 implementation they use -
kind=1 : int8
kind=2 : int16
kind=3 : int32
kind=4 : int64.

Just now I went to compile a program that had some code like "integer (kind=3) :: i, j, k" and it told me that kind=3 was not a valid integer kind.

I've just made a few quick tests and it seems that g95 integer kinds are defined as follows -
kind=1 : int8
kind=2 : int16
kind=4 : int32
kind=8 : int64.

Can someone please confirm that the above is correct?

BTW. I'm suspecting that the g95 implementation is actually the correct fortran95 standard and the SF ftn95 is the one that's breaking standard.
 

DrClaude

Mentor
6,807
2,923
BTW. I'm suspecting that the g95 implementation is actually the correct fortran95 standard and the SF ftn95 is the one that's breaking standard.
The standard doesn't specify the relation between the kind value of the size of the variable. Using hard-coded values for kind will lead to a program that is not portable. One has to use selected_int_kind.
 

Want to reply to this thread?

"Fortran compiler specific kind modifier." You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top