Atmel CAVR-4 Manual De Usuario
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
CAVR-4
Part 2. Compiler reference
IAR language extensions
271
Inline assembler
Inline assembler can be used for inserting assembler instructions in the generated
function.
function.
The syntax for inline assembler is:
asm("MOVW R4,R7");
In strict ISO/ANSI mode, the use of inline assembler is disabled.
For more details about inline assembler, see Mixing C and assembler, page 93.
C++ style comments
C++ style comments are accepted. A C++ style comment starts with the character
sequence
sequence
//
and continues to the end of the line. For example:
// The length of the bar, in centimeters.
int length;
__ALIGNOF__
For information about alignment, see Alignment, page 137, and __ALIGNOF__(), page
229.
229.
Compound literals
To create compound literals you can use the following syntax:
/* Create a pointer to an anonymous array */
int *p = (int []) {1,2,3};
/* Create a pointer to an anonymous structX */
structX *px = &(structX) {5,6,7};
Note:
●
A compound literal can be modified unless it is declared
const
●
Compound literals are not supported in Embedded C++.
Anonymous structs and unions
C++ includes a feature named anonymous unions. The AVR IAR C/C++ Compiler allow
a similar feature for both structs and unions.
a similar feature for both structs and unions.
An anonymous structure type (that is, one without a name) defines an unnamed object
(and not a type) whose members are promoted to the surrounding scope. External
anonymous structure types are allowed.
(and not a type) whose members are promoted to the surrounding scope. External
anonymous structure types are allowed.