Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 2. Compiler reference
IAR language extensions
275
Note: ISO/ANSI C allows extra commas in similar situations, for example after the last 
element of the initializers to an array. The reason is, that it is easy to get the commas 
wrong if parts of the list are moved using a normal cut-and-paste operation.
Example
enum 
{
   kOne,
   kTwo,   /* This is now allowed. */
};
Missing semicolon at end of struct or union specifier
A warning is issued if the semicolon at the end of a 
struct
 or union specifier is missing.
NULL and void
In operations on pointers, a pointer to 
void
 is always implicitly converted to another 
type if necessary, and a null pointer constant is always implicitly converted to a null 
pointer of the right type if necessary. In ISO/ANSI C, some operators allow such things, 
while others do not allow them.
A label preceding a "}"
In ISO/ANSI C, a label must be followed by at least one statement. Therefore, it is illegal 
to place the label at the end of a block. In the AVR IAR C/C++ Compiler, a warning is 
issued.
To create a standard-compliant C program (so that you will not have to see the warning), 
you can place an empty statement after the label. An empty statement is a single 
;
 
(semi-colon). 
Example
void test()
{
  if (...) goto end;
   /* Do something */
  end:  /* Illegal at the end of block. */
}
Note: This also applies to the labels of switch statements.