Atmel CAVR-4 Manual De Usuario
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
CAVR-4
Part 1. Using the compiler
Using C++
111
To set the equivalent option in IAR Embedded Workbench, select
Project>Options>C/C++ Compiler>Language.
Project>Options>C/C++ Compiler>Language.
Feature descriptions
When writing C++ source code for the IAR C/C++ Compiler, there are some benefits
and some possible quirks that you need to be aware of when mixing C++ features—such
as classes, and class members—with IAR language extensions, such as IAR-specific
attributes.
and some possible quirks that you need to be aware of when mixing C++ features—such
as classes, and class members—with IAR language extensions, such as IAR-specific
attributes.
CLASSES
A class type
class
and
struct
in C++ can have static and non-static data members,
and static and non-static function members. The non-static function members can be
further divided into virtual function members, non-virtual function members,
constructors, and destructors. For the static data members, static function members, and
non-static non-virtual function members the same rules apply as for statically linked
symbols outside of a class. In other words, they can have any applicable IAR-specific
type, memory, and object attribute.
further divided into virtual function members, non-virtual function members,
constructors, and destructors. For the static data members, static function members, and
non-static non-virtual function members the same rules apply as for statically linked
symbols outside of a class. In other words, they can have any applicable IAR-specific
type, memory, and object attribute.
The non-static virtual function members can have any applicable IAR-specific type,
memory, and object attribute as long as a pointer to the member function is implicitly
castable to the default function pointer type. The constructors, destructors, and
non-static data members cannot have any IAR attributes.
memory, and object attribute as long as a pointer to the member function is implicitly
castable to the default function pointer type. The constructors, destructors, and
non-static data members cannot have any IAR attributes.
For further information about attributes, see Type and object attributes, page 144.
Example
class A {
public:
static _ _near int i @ 600; //Located in near at address 600
static _ _nearfunc void f(); //Located in nearfunc memory
_ _nearfunc void g(); //Located in nearfunc memory
virtual _ _nearfunc void h();//Located in nearfunc memory
};
The
this
pointer used for referring to a class object will by default have the data
memory attribute for the default data pointer type. This means that such a class object
can only be defined to reside in memory from which pointers can be implicitly casted to
a default data pointer.
can only be defined to reside in memory from which pointers can be implicitly casted to
a default data pointer.