Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
274
Descriptions of language extensions
AVR® IAR C/C++ Compiler
Reference Guide
Empty translation units
A translation unit (source file) is allowed to be empty, that is, it does not have to contain 
any declarations.
In strict ISO/ANSI mode, a warning is issued if the translation unit is empty.
Example
The following source file is only used in a debug build. (In a debug build, the 
NDEBUG
 
preprocessor flag is undefined.) Since the entire contents of the file is conditionally 
compiled using the preprocessor, the translation unit will be empty when the application 
is compiled in release mode. Without this extension, this would be considered an error.
#ifndef NDEBUG
void PrintStatusToTerminal()
{
  /* Do something */
}
#endif
Comments at the end of preprocessor directives
This extension, which makes it legal to place text after preprocessor directives, is 
enabled, unless strict ISO/ANSI mode is used. This language extension exists to support 
compilation of old legacy code; we do not recommend that you write new code in this 
fashion.
Example
#ifdef FOO
  ... something ...
#endif FOO /* This is allowed but not recommended. */
Forward declaration of enums
The IAR Systems language extensions allow that you first declare the name of an 
enum
 
and later resolve it by specifying the brace-enclosed list.
Extra comma at end of enum list
It is allowed to place an extra comma at the end of an 
enum
 list. In strict ISO/ANSI 
mode, a warning is issued.