Next: , Previous: , Up: Extensions implemented in GNU Fortran   [Contents][Index]


6.1.15 Character conversion

Allowing character literals to be used in a similar way to Hollerith constants is a non-standard extension. This feature is enabled using -fdec-char-conversions and only applies to character literals of kind=1.

Character literals can be used in DATA statements and assignments with numeric (INTEGER, REAL, or COMPLEX) or LOGICAL variables. Like Hollerith constants they are copied byte-wise fashion. The constant will be padded with spaces or truncated to fit the size of the variable in which it is stored.

Examples:

      integer*4 x
      data x / 'abcd' /

      x = 'A'       ! Will be padded.
      x = 'ab1234'  ! Will be truncated.