29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Language Extensions<br />

3.3 C99 language features available in C++ and C90<br />

The compiler supports numerous extensions to the ISO C++ standard and to the C90<br />

language, for example, function prototypes that override old-style non prototype<br />

definitions.<br />

These extensions are available if:<br />

• the source language is C++ and you are compiling in non strict mode<br />

• the source language is C90 and you are compiling in non strict mode.<br />

These extensions are not available if:<br />

• the source language is C++ and the compiler is restricted to compiling strict C90<br />

using the --strict compiler option.<br />

• the source language is C90 and the compiler is restricted to compiling strict<br />

Standard C using the --strict compiler option.<br />

Note<br />

Language features of Standard C, for example long long integers, might be similar to<br />

the language extensions described in this section. Such features continue to remain<br />

available if you are compiling strict standard C++ or strict C90 using the --strict<br />

compiler option.<br />

3.3.1 Variadic macros<br />

In C90 and C++ you can declare a macro to accept a variable number of arguments.<br />

The syntax for declaring a variadic macro in C90 and C++ follows the C99 syntax for<br />

declaring a variadic macro, unless the option --gnu is selected. If the option --gnu is<br />

specified, the syntax follows GNU syntax for variadic macros.<br />

Example<br />

#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)<br />

void variadic_macros(void)<br />

{<br />

debug ("a test string is printed out along with %x %x %x\n", 12, 14, 20);<br />

}<br />

See also<br />

• --gnu on page 2-44<br />

<strong>ARM</strong> DUI 0348A Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. 3-7<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!