Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Studio 12.3: Fortran User's Guide Oracle Solaris Studio 12.3 Information Library |
2. Using Solaris Studio Fortran
4. Solaris Studio Fortran Features and Extensions
4.2.1.1 Rules Governing Boolean Type
4.2.1.2 Alternate Forms of Boolean Constants
4.2.1.3 Alternate Contexts of Boolean Constants
4.2.2 Abbreviated Size Notation for Numeric Data Types
4.2.3 Size and Alignment of Data Types
4.3.2 Purpose of Cray Pointers
4.3.3 Declaring Cray Pointers and Fortran 95 Pointers
4.3.4 Features of Cray Pointers
4.3.5 Restrictions on Cray Pointers
4.3.6 Restrictions on Cray Pointees
4.4 STRUCTURE and UNION (VAX Fortran)
4.6.2 IEEE Floating-Point Exception Handling
4.6.3 Command-Line Argument Intrinsics
4.6.5 Fortran 2003 Asynchronous I/O
4.6.6 Extended ALLOCATABLE Attribute
4.6.9 Fortran 2003 IMPORT Statement
4.6.10 Fortran 2003 FLUSH I/O Statement
4.6.11 Fortran 2003 POINTER INTENT Feature
4.6.12 Fortran 2003 Enhanced Array Constructor
4.6.13 Object-Oriented Fortran Support
4.6.14 Additional Fortran 2003 and Fortran 2008 Features
4.7.1 I/O Error Handling Routines
4.7.2 Variable Format Expressions
4.7.5 Miscellaneous I/O Extensions
4.8.1 Form of Special f95 Directive Lines
4.8.2 FIXED and FREE Directives
4.8.3 Parallelization Directives
4.9.2 The -use=list Option Flag
5. FORTRAN 77 Compatibility: Migrating to Solaris Studio Fortran
The f95 compiler provides the following source language features and extensions to the Fortran standard.
f95 allows 999 continuation lines (1 initial and 999 continuation lines). Standard Fortran 95 allows 19 for fixed-form and 39 for free-form.
In fixed-form source, lines can be longer than 72 characters, but everything beyond column 73 is ignored. Standard Fortran 95 only allows 72-character lines.
The f95 fixed-format source text is defined as follows:
A tab in any of columns 1 through 6 makes the line as a tab form source line.
A comment indicator or a statement number may precede the tab.
If a tab is the first nonblank character, then:
If the character after the tab is anything other than a nonzero digit, then the text following the tab is an initial line.
If there is a nonzero digit after the first tab, the line is a continuation line. The text following the nonzero digit is the next part of the statement.
The f95 default maximum line length is 72 columns for fixed form and 132 for free form. Use the -e compiler option to extend the lines in fixed-format source to 132 columns.
Example: The tab form source on the left is treated as shown on the right.
|
In the example above, ”^I” stands for the tab character, and the line starting with “1” and “2” are continuation lines. The coding is shown to illustrate various tab situations, and not to advocate any one style.
Tabs in f95 force the rest of the line to be padded out to column 72. This may cause unexpected results if the tab appears within a character string that is continued onto the next line:
Source file:
^Iprint *, "Tab on next line ^I1this continuation line starts with a tab." ^Iend
Running the code:
Tab on next line this continuation line starts with a tab.
When tab formatting is used with the —f77 option, there is no 132 character limit to the line length. The line can be much longer.
The source form assumed by f95 depends on options, directives, and suffixes.
Files with a .f or .F suffix are assumed to be in fixed format. Files with a .f90, .f95, .F90, or .F95 suffix are assumed to be in free format.
Table 4-1 F95 Source Form Command-line Options
|
If the -free or -fixed option is used, it overrides the file name suffix. If either a !DIR$ FREE or !DIR$ FIXED directive is used, it overrides the option and file name suffix.
Some mixing of source forms is allowed.
In the same f95 command, some source files can be fixed form, some free.
In the same file, free form can be mixed with fixed form by using !DIR$ FREE and !DIR$ FIXED directives.
In the same program unit, tab form can be mixed with free or fixed form.
Solaris Studio Fortran 95 is case insensitive by default. That means that a variable AbcDeF is treated as if it were spelled abcdef. Compile with the -U option to have the compiler treat upper and lower case as unique.