File: n_12.c

package info (click to toggle)
mcpp 2.7.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,024 kB
  • ctags: 29,151
  • sloc: ansic: 35,191; sh: 9,231; makefile: 176; cpp: 84; exp: 18
file content (59 lines) | stat: -rw-r--r-- 1,297 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* n_12.c:  Integer preprocessing number token and type of #if expression.  */

#include    "defs.h"
#include    <limits.h>

main( void)
{
    fputs( "started\n", stderr);

/* 12.1:    */
#if     LONG_MAX <= LONG_MIN
    fputs( "Bad evaluation of long.\n", stderr);
    exit( 1);
#endif
#if     LONG_MAX <= 1073741823  /* 0x3FFFFFFF   */
    fputs( "Bad evaluation of long.\n", stderr);
    exit( 1);
#endif

/* 12.2:    */
#if     ULONG_MAX / 2 < LONG_MAX
    fputs( "Bad evaluation of unsigned long.\n", stderr);
    exit( 1);
#endif

/* 12.3:    Octal number.   */
#if     0177777 != 65535
    fputs( "Bad evaluation of octal number.\n", stderr);
    exit( 1);
#endif

/* 12.4:    Hexadecimal number. */
#if     0Xffff != 65535 || 0xFfFf != 65535
    fputs( "Bad evaluation of hexadecimal number.\n", stderr);
    exit( 1);
#endif

/* 12.5:    Suffix 'L' or 'l'.  */
#if     0L != 0 || 0l != 0
    fputs( "Bad evaluation of 'L' suffix.\n", stderr);
    exit( 1);
#endif

/* 12.6:    Suffix 'U' or 'u'.  */
#if     1U != 1 || 1u != 1
    fputs( "Bad evaluation of 'U' suffix.\n", stderr);
    exit( 1);
#endif

/* 12.7:    Negative integer.   */
#if     0 <= -1
    fputs( "Bad evaluation of negative number.\n", stderr);
    exit( 1);
#endif

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