Skip to content

Commit

Permalink
[cpp.scope] Properly mark macro examples as such
Browse files Browse the repository at this point in the history
  • Loading branch information
je4d committed May 19, 2013
1 parent 3184b4f commit 75c667f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -867,16 +867,17 @@
a macro name.

\pnum
\enternote
\enterexample
The simplest use of this facility is to define a ``manifest constant,''
as in
\begin{codeblock}
#define TABSIZE 100
int table[TABSIZE];
\end{codeblock}
\exitnote
\exitexample

\pnum
\enterexample
The following defines a function-like
macro whose value is the maximum of its arguments.
It has the advantages of working for any compatible types of the arguments
Expand All @@ -896,8 +897,10 @@

The parentheses ensure that the arguments and
the resulting expression are bound properly.
\exitexample

\pnum
\enterexample
To illustrate the rules for redefinition and reexamination,
the sequence

Expand Down Expand Up @@ -932,8 +935,10 @@
int i[] = { 1, 23, 4, 5, };
char c[2][6] = { "hello", "" };
\end{codeblock}
\exitexample

\pnum
\enterexample
To illustrate the rules for creating character string literals
and concatenating tokens,
the sequence
Expand Down Expand Up @@ -982,8 +987,10 @@
and
\tcode{\#\#}
tokens in the macro definition is optional.
\exitexample

\pnum
\enterexample
To illustrate the rules for placemarker preprocessing tokens, the sequence

\begin{codeblock}
Expand All @@ -998,8 +1005,10 @@
int j[] = { 123, 45, 67, 89,
10, 11, 12, };
\end{codeblock}
\exitexample

\pnum
\enterexample
To demonstrate the redefinition rules,
the following sequence is valid.

Expand All @@ -1020,8 +1029,10 @@
#define FUNC_LIKE(b) ( a ) // different parameter usage
#define FUNC_LIKE(b) ( b ) // different parameter spelling
\end{codeblock}
\exitexample

\pnum
\enterexample
Finally, to show the variable argument list macro facilities:

\begin{codeblock}
Expand All @@ -1043,7 +1054,7 @@
((x>y) ? puts("x>y") : printf("x is %d but y is %d", x, y));

\end{codeblock}
\exitnote%
\exitexample
\indextext{macro!replacement|)}

\rSec1[cpp.line]{Line control}%
Expand Down

0 comments on commit 75c667f

Please sign in to comment.