[Skip to Body]
Primary:
[Front Door]
Current:
[Current Outline]
[Current EBoard]
Groupings:
[Documents]
[Outlines]
Misc:
[SamR]
[GNU Coding Standards]
#include directives.
#if and #ifdef directives.
cc -E or cpp.
#define MACRO(PARAMS) REPLACEMENT
#define SUM(X,Y) X+Y
printf ("%d\n", SUM(2,3));
printf ("%d\n", 2+3);
#PARAM gives the parameter as a C string.
FOO ## BAR concatenates FOO and BAR.
find the minimumalgorithm once (for
alltypes).
Examples/Min1
Examples/Min2
#define IMAX(A,B) A > ? B : A
int imax(A,B) { return A > ? B : A
inline int max(A,B) { ... };
while (1) FOO(BAR,BAZ);
Examples/loop.c
#define STUFF(A,B) do { printf ("%s", A); printf ("s", B); } while (0)
#define BOX(CODE) do { CODE } while (0)
#define STUFF(A,B) BOX( \
printf ("%s", A); \
printf ("%s", B); \
)
#define ITEST(EXP,EXPECTED) \
BOX ( \
int result = EXP; \
++__tests_conducted; \
if (result != EXPECTED) \
{ \
++__tests_failed; \
printf ("%s failed. Got %d, expected %d.\n", \
#EXP, result, EXPECTED);
} \
)
#define EXPERIMENT(CODE) BOX ( printf (" %s;\n", #CODE); CODE; )
__FILE__, the name of the current file
__LINE__, the number of the current line
#define EXPERIMENT(CODE) BOX ( printf (" %s.%03d: %s;\n", __FILE__, __LINE__, #CODE); CODE; )
[Skip to Body]
Primary:
[Front Door]
Current:
[Current Outline]
[Current EBoard]
Groupings:
[Documents]
[Outlines]
Misc:
[SamR]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Feb 20 13:11:55 2012.
The source to the document was last modified on Mon Feb 20 13:03:09 2012.
This document may be found at Outlines/cpp-continued.html.