Changeset ec20ab9 for doc/theses/jiada_liang_MMath/background.tex
- Timestamp:
- May 12, 2024, 8:42:31 PM (8 weeks ago)
- Branches:
- master
- Children:
- bf4fe05
- Parents:
- 07e9df1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/background.tex
r07e9df1 rec20ab9 74 74 However, it is restricted to integral values. 75 75 \begin{clang} 76 enum { Size = 20, Max = 10, MaxPlus10 = Max + 10, Max10Plus1, Fred = -7 };76 enum { Size = 20, Max = 10, MaxPlus10 = Max + 10, @Max10Plus1@, Fred = -7 }; 77 77 \end{clang} 78 78 Here, the aliased constants are: 20, 10, 20, 21, and -7. 79 79 Direct initialization is by a compile-time expression generating a constant value. 80 An enumerator without initializationis \newterm{auto-initialized}: from left to right, starting at zero or the next explicitly initialized constant, incrementing by @1@.80 Indirect initialization (without initialization, @Max10Plus1@) is \newterm{auto-initialized}: from left to right, starting at zero or the next explicitly initialized constant, incrementing by @1@. 81 81 Because multiple independent enumerators can be combined, enumerators with the same values can occur. 82 82 The enumerators are rvalues, so assignment is disallowed. … … 88 88 \begin{cfa} 89 89 typedef struct /* unnamed */ { ... } S; 90 struct /* unnamed */ { ... } x, y, z; 90 struct /* unnamed */ { ... } x, y, z; $\C{// questionable}$ 91 91 struct S { 92 union /* unnamed */ { 92 union /* unnamed */ { $\C{// unscoped fields}$ 93 93 int i; double d ; char ch; 94 94 }; … … 107 107 enum Week { 108 108 Thu@ = 10@, Fri, Sat, Sun, 109 Mon@ = 0@, Tue, Wed@,@ }; // terminating comma 109 Mon@ = 0@, Tue, Wed@,@ $\C{// terminating comma}$ 110 }; 110 111 \end{clang} 111 112 Note, the comma in the enumerator list can be a terminator or a separator, allowing the list to end with a dangling comma.\footnote{
Note: See TracChangeset
for help on using the changeset viewer.