Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 1. Using the compiler
27
Functions 
This chapter contains information about functions. First, you get a brief 
overview of mechanisms for controlling functions, as well as information about 
memory type attributes for function storage. Then, the special function types 
interrupt and monitor are described, including how to declare C++ member 
functions by using special function types.
Controlling functions
Writing a function in C or C++, you may want to control for example the following:
The used calling convention, see Calling convention, page 99.
The AVR IAR C/C++ Compiler provides a wide set of extended keywords which let you 
control a function.
EXTENDED KEYWORDS FOR FUNCTIONS
The extended keywords that can be used for functions can be divided into three groups:
Keywords that control the placement and type of the functions. Keywords of this 
group must be specified both when the function is declared and when it is defined: 
_ _nearfunc
 and
 _ _farfunc
.
Keywords that control the type of the functions. Keywords of this group only have 
to be specified when the function is defined: 
_ _interrupt
_ _task
, and 
_ _version_1
.
Keywords that only control the defined function: 
_ _root
_ _monitor
, and 
_ _noreturn
.
Keywords that control the placement and type of the functions are also referred to as 
type attributes. Typically these functions controls aspects of the function visible to the 
surrounding context. Keywords that only control the behavior of the function and do not 
affect the function interface are referred to as object attributes. To read more about type 
and object attributes, see Type and object attributes, page 144. For reference information 
about each keyword, see the chapter Extended keywords, page 203.