-qro

Category

Object code control

Pragma equivalent

#pragma options ro, #pragma strings

Purpose

Specifies the storage type for string literals.

When ro or strings=readonly is in effect, strings are placed in read-only storage. When noro or strings=writeable is in effect, strings are placed in read/write storage.

Syntax

Read syntax diagramSkip visual syntax diagram
Option syntax

        .-ro---.   
>>- -q--+-noro-+-----------------------------------------------><

Read syntax diagramSkip visual syntax diagram
Pragma syntax

                          .-readonly--.      
>>-#--pragma--strings--(--+-writeable-+--)---------------------><

Defaults

Strings are read-only for all invocation commands except cc. If the cc invocation command is used, strings are writeable.

Parameters

readonly (pragma only)
String literals are to be placed in read-only memory.
writeable (pragma only)
String literals are to be placed in read-write memory.

Usage

Placing string literals in read-only memory can improve runtime performance and save storage. However, code that attempts to modify a read-only string literal may generate a memory error.

The pragmas must appear before any source statements in a file.

Predefined macros

None.

Examples

To compile myprogram.c so that the storage type is writable, enter:
xlc myprogram.c -qnoro

Related information