Atmel CAVR-4 Manual De Usuario
CAVR-4
276
Descriptions of language extensions
AVR® IAR C/C++ Compiler
Reference Guide
The following piece of code will generate a warning:
switch (x)
{
case 1:
...;
break;
default:
}
A good way to convert this into a standard-compliant C program is to place a
break;
statement after the
default:
label.
Empty declarations
An empty declaration (a semicolon by itself) is allowed, but a remark is issued (provided
that remarks are enabled).
that remarks are enabled).
This is useful when preprocessor macros are used that could expand to nothing.
Consider the following example. In a debug build, the macros
Consider the following example. In a debug build, the macros
DEBUG_ENTER
and
DEBUG_LEAVE
could be defined to something useful. However, in a release build they
could expand into nothing, leaving the
;
character in the code:
void test()
{
DEBUG_ENTER();
do_something();
DEBUG_LEAVE();
}
Single value initialization
ISO/ANSI C requires that all initializer expressions of static arrays,
structs
, and
unions
are enclosed in braces.
Single-value initializers are allowed to appear without braces, but a warning is issued.
Example
In the AVR IAR C/C++ Compiler, the following expression is allowed:
struct str
{
int a;
} x = 10;