29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.70 Macros with a variable number of arguments in C99<br />

You can declare a macro in C99 that accepts a variable number of arguments. The syntax <strong>for</strong><br />

defining such a macro is similar to that of a function. For example:<br />

#define debug(<strong>for</strong>mat, ...) fprintf (stderr, <strong>for</strong>mat, __VA_ARGS__)<br />

void Variadic_Macros_0()<br />

{<br />

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

}<br />

5.70.1 See also<br />

Concepts<br />

• New language features of C99 on page 5-77.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-88<br />

ID061811<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!