File: recurs.t

package info (click to toggle)
mcpp 2.7.2-4
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 8,584 kB
  • ctags: 29,739
  • sloc: ansic: 35,240; sh: 9,241; makefile: 116; cpp: 84; exp: 18
file content (21 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* recurs.t:    recursive macro */
/* The sample posted to comp.std.c by B. Stroustrap.    */

#define NIL(xxx)    xxx
#define G_0(arg)    NIL(G_1)(arg)
#define G_1(arg)    NIL(arg)

G_0(42)

/*
 * Note by kmatsui:
 * There are two interpretations on the Standard's specification.
 * (1)  This macro should be expanded to 'NIL(42)'.
 * (2)  This macro should be expanded to '42'.
 * The Standard's wording seems to justify the (1).
 * GCC, Visual C++ and other major implementations, however, expand
 * this macro as (2).
 * MCPP V.2.4.1 or later of Standard mode expands this as (1) by default,
 * and expands as (2) when invoked with -@compat option.
 */