File: n_2.c

package info (click to toggle)
mcpp 2.7.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 8,940 kB
  • sloc: ansic: 35,244; sh: 9,241; makefile: 116; cpp: 84; exp: 18
file content (41 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* n_2.c:   Line splicing by <backslash><newline> sequence. */

#include    "defs.h"

main( void)
{
    int     ab = 1, cd = 2, ef = 3, abcde = 5;

    fputs( "started\n", stderr);

/* 2.1: In a #define directive line, between the parameter list and the
        replacement text.   */
#define FUNC( a, b, c)  \
        a + b + c
    assert( FUNC( ab, cd, ef) == 6);

/* 2.2: In a #define directive line, among the parameter list and among the
        replacement text.   */
#undef  FUNC
#define FUNC( a, b  \
    , c)            \
    a + b           \
    + c
    assert (FUNC( ab, cd, ef) == 6);

/* 2.3: In a string literal.    */
    assert (strcmp( "abc\
de", "abcde") == 0);

/* 2.4: <backslash><newline> in midst of an identifier. */
    assert( abc\
de == 5);

/* 2.5: <backslash><newline> by trigraph.   */
    assert( abc??/
de == 5);

    fputs( "success\n", stderr);
    return  0;
}