
CAVR-4
x
AVR® IAR C/C++ Compiler
Reference Guide
Preserved versus scratch registers ...................................................101
Function call ....................................................................................102
Function exit ...................................................................................105
Return address handling ...................................................................106
Restrictions for special function types .............................................106
Examples ..........................................................................................107
Call frame information .......................................................................108
Using C++ .......................................................................................................... 109
Overview ..................................................................................................109
Standard Embedded C++ .................................................................109
IAR Extended Embedded C++ ........................................................110
Enabling C++ support ......................................................................110
Feature descriptions ............................................................................111
Classes ..............................................................................................111
Functions ..........................................................................................114
New and Delete operators ................................................................114
Templates ........................................................................................115
Variants of casts ...............................................................................118
Mutable ............................................................................................118
Namespace ......................................................................................119
The STD namespace ........................................................................119
Pointer to member functions ............................................................119
Using interrupts and EC++ destructors ............................................119
Efficient coding for embedded applications ...................................... 121
Taking advantage of the compilation system ...........................121
Controlling compiler optimizations .................................................122
Fine-tuning enabled transformations ...............................................123
Selecting data types and placing data in memory ..................125
Locating strings in ROM, RAM and flash .......................................125
Using efficient data types .................................................................126
Memory model and memory attributes for data ...............................128
Using the best pointer type ...............................................................128
Anonymous structs and unions ........................................................128