Atmel CAVR-4 ユーザーズマニュアル
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
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;