-qroconst

Description

Specifies the storage location for constant values.

Syntax

Read syntax diagramSkip visual syntax diagram        .-roconst---.
>>- -q--+-noroconst-+------------------------------------------><

See also #pragma options.

Default

The default with xlc, xlC, and c89 is -qroconst. The default with cc is -qnoroconst.

Notes

If -qroconst is specified, the compiler places constants in read-only storage. If -qnoroconst is specified, constant values are placed in read/write storage.

Placing constant values in read-only memory can improve runtime performance, save storage, and provide shared access. Code that attempts to modify a read-only constant value generates a memory error.

Constant value in the context of the -qroconst option refers to variables that are qualified by const (including const-qualified characters, integers, floats, enumerations, structures, unions, and arrays). The following variables do not apply to this option:

The -qroconst option does not imply the -qro option. Both options must be specified if you wish to specify storage characteristics of both string literals (-qro) and constant values (-qroconst).

Related information