-qro
Category
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
Option syntax .-ro---. >>- -q--+-noro-+-----------------------------------------------><
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.
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