-qctyplss

Category

Portability and migration

Purpose

Specifies whether character constant expressions are allowed wherever typeless constants may be used.

This language extension might be needed when you are porting programs from other platforms.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-noctyplss-----------------.   
>>- -q--+-ctyplss--+--------------+-+--------------------------><
                   |    .-noarg-. |     
                   '-=--+-arg---+-'     

@PROCESS:

@PROCESS CTYPLSS[([NO]ARG)]| NOCTYPLSS

Defaults

-qnoctyplss

Parameters

arg | noarg
Suboptions retain the behavior of -qctyplss. Additionally, arg specifies that Hollerith constants used as actual arguments will be treated as integer actual arguments.

Usage

With -qctyplss, character constant expressions are treated as if they were Hollerith constants and thus can be used in logical and arithmetic expressions.

  • If you specify the -qctyplss option and use a character-constant expression with the %VAL argument-list keyword, a distinction is made between Hollerith constants and character constants. Character constants are placed in the rightmost byte of the register and padded on the left with zeros, while Hollerith constants are placed in the leftmost byte and padded on the right with blanks. All of the other %VAL rules apply.
  • The option does not apply to character expressions that involve a constant array or subobject of a constant array at any point.

Examples

Example 1: In the following example, the compiler option -qctyplss allows the use of a character constant expression.

@PROCESS CTYPLSS
      INTEGER I,J
      INTEGER, PARAMETER :: K(1) = (/97/)
      CHARACTER, PARAMETER :: C(1) = (/'A'/)

      I = 4HABCD          ! Hollerith constant
      J = 'ABCD'          ! I and J have the same bit representation

! These calls are to routines in other languages.
      CALL SUB(%VAL('A')) ! Equivalent to CALL SUB(97)
      CALL SUB(%VAL(1HA)) ! Equivalent to CALL SUB(1627389952)

! These statements are not allowed because of the constant-array
! restriction.
!     I = C // C
!     I = C(1)
!     I = CHAR(K(1))
      END
Example 2: In the following example, the variable J is passed by reference. The suboption arg specifies that the Hollerith constant is passed as if it were an integer actual argument.
@PROCESS CTYPLSS(ARG)
      INTEGER :: J

      J = 3HIBM
! These calls are to routines in other languages.
      CALL SUB(J)
      CALL SUB(3HIBM)   ! The Hollerith constant is passed as if
                        ! it were an integer actual argument

Related information