Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 218 2012-2013 Microchip Technology Inc.
Macro expansion using arguments can use the # character to convert an argument to
a string, and the ## sequence to concatenate arguments. If two expressions are being
concatenated, consider using two macros in case either expression requires substitu-
tion itself, so for example
#define paste1(a,b) a##b
#define paste(a,b) paste1(a,b)
lets you use the paste macro to concatenate two expressions that themselves may
require further expansion. Remember that once a macro identifier has been expanded,
it will not be expanded again if it appears after concatenation.
For implementation-defined behavior of preprocessing directives, see
Section A.14 Preprocessing Directives.
19.4 PREDEFINED MACRO NAMES
The compiler predefines several macros which can be tested by conditional directives
in source code. Constants that have been deprecated may be found in Appendix
F. Deprecated Features.
19.4.1 Compiler Version Macro
The compiler will define the constant __XC16_VERSION__ , giving a numeric value to
the version identifier. This can be used to take advantage of new compiler features
while remaining backwardly compatible with older versions.
The value is based upon the major and minor version numbers of the current release.
For example, release version 1.00 will have a __XC16_VERSION__ definition of 1000.
This macro can be used, in conjunction with standard preprocessor comparison state-
ments, to conditionally include/exclude various code constructs.
The current definition of __XC16_VERSION__ can be discovered by adding
--version to the command line, or by inspecting the README.html file that came
with the release.
#ifdef Include source lines if preprocessor
symbol defined
#ifdef FLAG
do_loop();
#elif SIZE == 5
skip_loop();
#endif
#ifndef Include source lines if preprocessor
symbol not defined
#ifndef FLAG
jump();
#endif
#include Include text file into source #include <stdio.h>
#include "project.h"
#line Specify line number and file name for
listing
#line 3 final
#pragma Compiler specific options Refer to Section 19.5 Pragmas vs.
Attributes
#undef Undefines preprocessor symbol #undef FLAG
#warning Generate a warning message #warning Length not set
TABLE 19-1: PREPROCESSOR DIRECTIVES (CONTINUED)
Directive Meaning Example

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh