Where local optimizations have been enabled, pointers can have a size and classification based purely on their definition, not on the targets assigned to them by the program.
The pointer-target specifiers, __ram
and
__rom
, (see Pointer-target Qualifiers) can be used to ensure that addresses
assigned to a pointer during the program’s execution are within an intended memory space.
Together with a restricted range of pointer classifications, this ensures that pointers
will have a size that is predictable.
Pointers defined in code built with local optimizations and which have the indicated targets will have the following sizes, where type is a valid, unqualified C type.
const type *
__rom type *
const
specifier can be optionally used with
__rom
without changing the pointer size.type *
const
object
is assigned to such pointers. These pointers are always 2 bytes in size.__ram type *
const
specifier
indicates only that the target objects must be treated as read-only. The
const
specifier can be optionally used with
__ram
without changing the pointer size.The size and operation of pointers to __far
, pointers to
__eeprom
, and function pointers are not affected by the local
optimization setting.