Ignore:
Timestamp:
May 13, 2024, 10:26:59 AM (5 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
e6f1a4b
Parents:
acb33f15 (diff), ca4f2b2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/CFAenum.tex

    racb33f15 r31f4837  
    1111
    1212C already provides @const@-style aliasing using the unnamed enumerator \see{\VRef{s:TypeName}}, even if the name @enum@ is misleading (@const@ would be better).
    13 Given the existence of this form, it is straightforward to extend it with types other than integers.
     13Given the existence of this form, it is straightforward to extend it with types other than @int@.
    1414\begin{cfa}
    1515enum E { Size = 20u, PI = 3.14159L, Jack = L"John" };
     
    2121
    2222
    23 \section{Enumerator Unscoping}
    24 \label{s:EnumeratorUnscoping}
    25 
    26 In C, unscoped enumerators presents a \newterm{naming problem} when multiple enumeration types appear in the same scope with duplicate enumerator names.
     23\section{Enumerator Visibility}
     24\label{s:EnumeratorVisibility}
     25
     26In C, unscoped enumerators present a \newterm{naming problem} when multiple enumeration types appear in the same scope with duplicate enumerator names.
    2727There is no mechanism in C to resolve these naming conflicts other than renaming one of the duplicates, which may be impossible.
    2828
     
    3333enum E1 { First, Second, Third, Fourth };
    3434enum E2 { @Fourth@, @Third@, @Second@, @First@ }; $\C{// same enumerator names}$
    35 E1 p() { return Third; }                                $\C{// correctly resolved duplicate names}$
     35E1 p() { return Third; }                                $\C{// return}$
    3636E2 p() { return Fourth; }
    3737void foo() {
     
    5454enum RGB @!@ { Red, Green, Blue };
    5555\end{cfa}
    56 Now the enumerators \emph{must} be qualified with the associated enumeration.
     56Now the enumerators \emph{must} be qualified with the associated enumeration type.
    5757\begin{cfa}
    5858Week week = @Week.@Mon;
     
    6868}
    6969\end{cfa}
    70 As in Section~\ref{s:EnumeratorUnscoping}, opening multiple scoped enumerations in a @with@ can result in duplicate enumeration names, but \CFA implicit type resolution and explicit qualification/casting handles ambiguities.
     70As in Section~\ref{s:EnumeratorVisibility}, opening multiple scoped enumerations in a @with@ can result in duplicate enumeration names, but \CFA implicit type resolution and explicit qualification/casting handle ambiguities.
    7171
    7272\section{Enumeration Trait}
     
    344344\end{cfa}
    345345which make @Third == First@ and @Fourth == Second@, causing a compilation error because of duplicase @case@ clauses.
    346 To better match with programmer intuition, \CFA toggles between value and position semantics depneding on the language context.
     346To better match with programmer intuition, \CFA toggles between value and position semantics depending on the language context.
    347347For conditional clauses and switch statments, \CFA uses the robust position implementation.
    348348\begin{cfa}
Note: See TracChangeset for help on using the changeset viewer.