source:
src/Tests/CharStringConstants.c
@
1ad1c99e
Last change on this file since 1ad1c99e was b1d6dd5, checked in by , 9 years ago | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[51b7345] | 1 | int main() { |
2 | // character constants | |
3 | ||
4 | ' '; | |
5 | 'a'; | |
6 | '"'; | |
7 | '_'; | |
8 | ||
9 | '\a'; // simple escape | |
10 | '\b'; | |
11 | '\e'; // GCC | |
12 | '\f'; | |
13 | '\n'; | |
14 | '\r'; | |
15 | '\t'; | |
16 | '\v'; | |
17 | '\''; | |
[3848e0e] | 18 | '\"'; |
[51b7345] | 19 | '\?'; |
20 | '\\'; | |
21 | ||
22 | '\0'; // octal escape | |
[3848e0e] | 23 | |
[51b7345] | 24 | '\377'; |
25 | ||
26 | '\xf'; // hex escape | |
27 | '\xff'; | |
28 | ||
29 | // warnings/errors | |
30 | ||
31 | ''; // empty character | |
32 | 'aa'; // multi-character | |
33 | 'a\na'; // multi-character, embedded escape | |
34 | 'a\0a'; | |
35 | '\xfff'; // hex escape out of range | |
36 | '_\377_'; // multi-character | |
37 | '_\xff_'; | |
38 | '\xffff'; // hex escape out of range | |
39 | 'a\xff34w'; | |
40 | '\xf_f'; // multi-character | |
41 | '\xff_ff'; | |
42 | ||
43 | // string constants | |
44 | ||
45 | " "; | |
46 | "a"; | |
47 | "'"; | |
48 | '_'; | |
49 | ||
50 | "\a"; // simple escape | |
51 | "\b"; | |
52 | "\e"; // GCC | |
53 | "\f"; | |
54 | "\n"; | |
55 | "\r"; | |
56 | "\t"; | |
57 | "\v"; | |
58 | "\'"; | |
59 | "\""; | |
60 | "\?"; | |
61 | "\\"; | |
62 | ||
63 | "\0"; // octal escape | |
64 | "\377"; | |
65 | ||
66 | "\xf"; // hex escape | |
67 | "\xff"; | |
68 | ||
69 | ""; | |
70 | "aa"; | |
71 | "a\na"; | |
72 | "a\0a"; | |
73 | "_\377_"; | |
74 | "_\xff_"; | |
75 | "\xf_f"; | |
76 | ||
77 | // warnings/errors | |
78 | ||
[3848e0e] | 79 | "\xff_ff"; |
[51b7345] | 80 | "\xfff"; // hex escape out of range |
81 | "a\xff34w"; | |
82 | "\xffff"; | |
83 | } | |
[3848e0e] | 84 | |
85 | // Local Variables: // | |
86 | // compile-command: "../../../bin/cfa -std=c99 CharStringConstants.c" // | |
87 | // End: // |
Note: See TracBrowser
for help on using the repository browser.