Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
270
Descriptions of language extensions
AVR® IAR C/C++ Compiler
Reference Guide
See the chapter Extended keywords for a complete list of attributes.
Placement at an absolute address or in a named segment
The operator 
@
 or the directive #
pragma
 
location
 can be used for placing a variable 
at an absolute address, or placing a variable or function in a named segment. The named 
segment can either be a predefined segment, or a user-defined segment.
Example 1
_ _no_init int x @ 0x1000;
An absolute declared variable cannot have an initializer, which means the variable must 
also be 
_ _no_init
 or 
const
 declared.
Example 2
void test(void) @ "MYOWNSEGMENT"
{
  ...
Note that all segments, both user-defined and predefined, must be assigned a location, 
which is done in the linker command file.
_Pragma 
For information about the preprocessor operator 
_Pragma
Variadic macros 
Variadic macros are the preprocessor macro equivalents of 
printf
 style functions. For 
more information, see __VA_ARGS__, page 235.
Inline functions
The 
inline
 keyword can be used on functions. It works just like the C++ keyword 
inline
 and the 
#pragma inline
 directive.
Mixing declarations and statements
It is possible to mix declarations and statements within the same scope.
Declaration in for loops
It is possible to have a declaration in the initialization expression of a 
for
 loop.