Changeset c1c0efdb for doc/theses/jiada_liang_MMath/Cenum.tex
- Timestamp:
- Aug 8, 2024, 10:02:34 PM (2 months ago)
- Branches:
- master
- Children:
- 7568e5c
- Parents:
- 11cced6
- git-author:
- Peter A. Buhr <pabuhr@…> (08/08/24 22:01:56)
- git-committer:
- Peter A. Buhr <pabuhr@…> (08/08/24 22:02:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/Cenum.tex
r11cced6 rc1c0efdb 15 15 enum E2 { @Fourth@, @Third@, @Second@, @First@ }; $\C{// same enumerator names}$ 16 16 \end{cfa} 17 There is no mechanism in C to resolve these naming conflicts other than renaming one of the duplicates, which may be impossible if the conflict comes from system -includefiles.17 There is no mechanism in C to resolve these naming conflicts other than renaming one of the duplicates, which may be impossible if the conflict comes from system include-files. 18 18 19 19 The \CFA type-system allows extensive overloading, including enumerators. 20 20 Hence, most ambiguities among C enumerators are implicitly resolved by the \CFA type system, possibly without any programmer knowledge of the conflict. 21 In addition, C Enum qualification is added, exactly like aggregate field 21 In addition, C Enum qualification is added, exactly like aggregate field-qualification, to disambiguate. 22 22 \VRef[Figure]{f:EnumeratorVisibility} shows how resolution, qualification, and casting are used to disambiguate situations for enumerations @E1@ and @E2@. 23 23 … … 68 68 69 69 \section{Type Safety} 70 \label{s:TypeSafety} 70 71 71 72 As in Section~\ref{s:Usage}, C's implicit bidirectional conversion between enumeration and integral type raises a safety concern. … … 101 102 \item[How widely used:] Common. 102 103 \end{description} 103 104 \begin{comment}105 \begin{description}[parsep=0pt]106 \item[Change:] In \CC, the type of an enumerator is its enumeration.107 In C, the type of an enumerator is @int@.108 Example:109 \begin{cfa}110 enum e { A };111 sizeof(A) == sizeof(int) $\C{// in C}$112 sizeof(A) == sizeof(e) $\C{// in \CC}$113 /* and sizeof(int) is not necessary equal to sizeof(e) */114 \end{cfa}115 \item[Rationale:] In \CC, an enumeration is a distinct type.116 \item[Effect on original feature:] Change to semantics of well-defined feature.117 \item[Difficulty of converting:] Semantic transformation.118 \item[How widely used:] Seldom. The only time this affects existing C code is when the size of an enumerator is119 taken. Taking the size of an enumerator is not a common C coding practice.120 \end{description}121 \end{comment}
Note: See TracChangeset
for help on using the changeset viewer.