Specifies the storage location for constant values.
See also #pragma options.
The default with xlc, xlC, and c89 is -qroconst. The default with cc is -qnoroconst.
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:
- variables qualified with volatile and aggregates (such as a struct or a union) that contain volatile variables
- pointers and complex aggregates containing pointer members
- automatic and static types with block scope
- uninitialized types
- regular structures with all members qualified by const
- initializers that are addresses, or initializers that are cast to non-address values
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).