Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

4.5 Unsigned Integers

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