-qro

Purpose

Specifies the storage type for string literals.

When -qro or #pragma strings (readonly) is in effect, strings are placed in read-only memory. When -qnoro or #pragma strings (writeable) is in effect, strings are placed in read-write memory.

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

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

C++ only Strings are read-only.

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



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us