Pragma equivalent
#pragma options [no]roconst
Purpose
Specifies the storage location for constant
values.
When roconst is in effect, constants are placed in
read-only storage. When noroconst is in effect,
constants are placed in read/write storage.
Syntax
.-roconst---.
>>- -q--+-noroconst-+------------------------------------------><
Defaults
- -qroconst for all compiler
invocations except cc and
its derivatives. -qnoroconst for the cc invocation and its derivatives.
- -qroconst
Usage
Placing constant values in read-only memory can improve runtime performance,
save storage, and provide shared access. However, code that attempts to modify
a read-only constant value generates a memory error.
"Constant" 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 constructs are not affected by this option:
- Variables qualified with volatile and aggregates (such as a
structure 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).