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.1.1 Continuation Line Limits
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 Fortran compiler accepts a new data type, UNSIGNED, as an extension to the language. Four KIND parameter values are accepted with UNSIGNED: 1, 2, 4, and 8, corresponding to 1-, 2-, 4-, and 8-byte unsigned integers, respectively.
The form of an unsigned integer constant is a digit-string followed by the upper or lower case letter U, optionally followed by an underscore and kind parameter. The following examples show the maximum values for unsigned integer constants:
255u_1 65535u_2 4294967295U_4 18446744073709551615U_8
Expressed without a kind parameter (12345U), the default is the same as for default integer. This is U_4 but can be changed by the -xtypemap option, which will change the kind type for default unsigned integers.
Declare an unsigned integer variable or array with the UNSIGNED type specifier:
UNSIGNED U UNSIGNED(KIND=2) :: A UNSIGNED*8 :: B
Binary operations, such as + - * / cannot mix signed and unsigned operands. That is, U*N is illegal if U is declared UNSIGNED, and N is a signed INTEGER.
Use the UNSIGNED intrinsic function to combine mixed operands in a binary operation, as in U*UNSIGNED(N)
An exception is when one operand is an unsigned integer and the other is a signed integer constant expression with positive or zero value; the result is an unsigned integer.
The kind of the result of such a mixed expression is the largest kind of the operands.
Exponentiation of a signed value is signed while exponentiation of an unsigned value is unsigned.
Unary minus of an unsigned value is unsigned.
Unsigned operands may mix freely with real, complex operands. (Unsigned operands cannot be mixed with interval operands.)
Signed and unsigned integer operands may be compared using intrinsic relational operations. The result is based on the unaltered value of the operands.
The CASE construct accepts unsigned integers as case-expressions.
Unsigned integers are not permitted as DO loop control variables, or in arithmetic IF control expressions.
Unsigned integers can be read and written using the I, B, O, and Z edit descriptors.
They can also be read and written using list-directed and namelist I/O. The written form of an unsigned integer under list-directed or namelist I/O is the same as is used for positive signed integers.
Unsigned integers can also be read or written using unformatted I/O.
Unsigned integers are allowed in intrinsic functions, except for SIGN and ABS.
A new intrinsic function, UNSIGNED, is analogous to INT but produces a result of unsigned type. The form is
UNSIGNED(v [,kind] ).
Another new intrinsic function, SELECTED_UNSIGNED_KIND( var), returns the kind parameter for var.
Intrinsic functions do not allow both signed and unsigned integer operands, except for the MAX and MIN functions, which allow both signed and unsigned integer operands only if there is at least one operand of REAL type.
Unsigned arrays cannot appear as arguments to array intrinsic functions.