1 | This is a partial list of how `gcc -traditional' disagrees with |
---|
2 | traditional C compilers (perhaps only some of them). Most of these |
---|
3 | differences are not bugs. |
---|
4 | |
---|
5 | --------------------------------------------------------------------------- |
---|
6 | K&R-1 (2.4.3) says: |
---|
7 | |
---|
8 | "If the character following a backslash is not one of those |
---|
9 | specified {in the table above}, the backslash is ignored." |
---|
10 | |
---|
11 | Up until recently, `gcc -traditional' complained about \x \a and \v |
---|
12 | appearing in a character or string literal. I believe however that |
---|
13 | this non-feature has been eliminated (recently). |
---|
14 | |
---|
15 | --------------------------------------------------------------------------- |
---|
16 | When in -traditional mode, gcc allows the following erroneous pair of |
---|
17 | declarations to appear together in a given scope: |
---|
18 | |
---|
19 | typedef int foo; |
---|
20 | typedef foo foo; |
---|
21 | |
---|
22 | --------------------------------------------------------------------------- |
---|
23 | K&R-1 (8.5) says: |
---|
24 | |
---|
25 | "No field may be wider than a word." |
---|
26 | |
---|
27 | Gcc however allows: |
---|
28 | |
---|
29 | struct S { int i:33; }; |
---|
30 | |
---|
31 | --------------------------------------------------------------------------- |
---|
32 | In K&R-1 there is no restriction against comments crossing include file |
---|
33 | boundaries. Gcc however doesn't allow this, even when in -traditional mode. |
---|
34 | |
---|
35 | --------------------------------------------------------------------------- |
---|
36 | Regarding the length of identifiers, K&R-1 (2.2) says: |
---|
37 | |
---|
38 | "No more than the first eight characters are significant, |
---|
39 | although more may be used." |
---|
40 | |
---|
41 | Gcc treats all characters of identifiers as significant, even when in |
---|
42 | -traditional mode. |
---|
43 | |
---|
44 | --------------------------------------------------------------------------- |
---|
45 | K&R-1 (2.2) says: |
---|
46 | |
---|
47 | "An identifier is a sequence of letters and digits; the first |
---|
48 | character must be a letter. The underscore _ counts as a letter." |
---|
49 | |
---|
50 | Gcc also allows dollar signs in identifiers. (This may also be an issue |
---|
51 | for the -pedantic option.) |
---|
52 | |
---|
53 | --------------------------------------------------------------------------- |
---|
54 | |
---|
55 | |
---|