-qescape

Category

Portability and migration

Purpose

Specifies how the backslash is treated in character strings, Hollerith constants, H edit descriptors, and character string edit descriptors.

It can be treated as an escape character or as a backslash character. This language extension might be needed when you are porting programs from other platforms.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-escape---.   
>>- -q--+-noescape-+-------------------------------------------><

@PROCESS:

@PROCESS ESCAPE | NOESCAPE

Defaults

-qescape

Usage

When -qescape is specified, the backslash is interpreted as an escape character in these contexts. If you specify -qnoescape, the backslash is treated as the backslash character.

The default setting is useful for the following:
  • Porting code from another Fortran compiler that uses the backslash as an escape character.
  • Including "unusual" characters, such as tabs or newlines, in character data. Without this option, the alternative is to encode the ASCII values (or EBCDIC values, on mainframe systems) directly in the program, making it harder to port.

If you are writing or porting code that depends on backslash characters being passed through unchanged, specify -qnoescape so that they do not get any special interpretation. You could also write \\ to mean a single backslash character under the default setting.

Examples

$ # Demonstrate how backslashes can affect the output
$ cat escape.f
       PRINT *,'a\bcde\fg'
       END
$ xlf95 escape.f
** _main === End of Compilation 1 ===
1501-510  Compilation successful for file escape.f.
$ a.out
cde
    g
$ xlf95 -qnoescape escape.f
** _main === End of Compilation 1 ===
1501-510  Compilation successful for file escape.f.
 $ a.out
  a\bcde\fg  

In the first compilation, with the default setting of -qescape, \b is printed as a backspace, and \f is printed as a formfeed character.

With the -qnoescape option specified, the backslashes are printed like any other character.

Related information

The list of escape sequences that XL Fortran recognizes is shown in Escape sequences for character strings .