Atmel CAVR-4 사용자 설명서
CAVR-4
22
C++ and memory types
AVR® IAR C/C++ Compiler
Reference Guide
In short:
C++ and memory types
A C++ class object is placed in one memory type, in the same way as for normal C
structures. However, the class members that are considered to be part of the object are
the non-static member variables. The static member variables can be placed individually
in any kind of memory.
structures. However, the class members that are considered to be part of the object are
the non-static member variables. The static member variables can be placed individually
in any kind of memory.
Remember, in C++ there is only one instance of each static member variable, regardless
of the number of class objects.
of the number of class objects.
Also note that for non-static member functions—unless class memory is used, see
Classes, page 111—the
Classes, page 111—the
this
pointer will be of the default data pointer type. This means
that it must be possible to convert a pointer to the object to the default pointer type. The
restrictions that apply to the default pointer type also apply to the
restrictions that apply to the default pointer type also apply to the
this
pointer.
int _ _flash * e;
A pointer stored in default memory. The pointer
points to an integer in flash memory.
points to an integer in flash memory.
int _ _flash * _ _eeprom f;
A pointer stored in eeprom memory pointing to
an integer stored in flash memory.
an integer stored in flash memory.
int _ _eeprom * myFunction(
int _ _flash *);
A declaration of a function that takes a
parameter which is a pointer to an integer stored
in flash memory. The function returns a pointer
to an integer stored in eeprom memory.
parameter which is a pointer to an integer stored
in flash memory. The function returns a pointer
to an integer stored in eeprom memory.
int
The basic type is an integer.
int _ _flash
The integer is stored in flash memory.
int _ _flash *
This is a pointer to the integer.
int _ _flash * _ _eeprom
The pointer is stored in eeprom memory.