Ignore:
Timestamp:
Aug 8, 2024, 5:25:41 PM (20 hours ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
11cced6
Parents:
ab11ab1
Message:

Move partial scope to future work

File:
1 edited

Legend:

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

    rab11ab1 rc4aca65  
    11\chapter{C Enumeration in \texorpdfstring{\CFA}{Cforall}}
    22
    3 \CFA supports legacy C enumeration using the same syntax for backwards compatibility.
     3\CFA supports legacy C enumeration using the same syntax for backward compatibility.
    44A C-style enumeration in \CFA is called a \newterm{C Enum}.
    55The semantics of the C Enum is mostly consistent with C with some restrictions.
     
    1515enum E2 { @Fourth@, @Third@, @Second@, @First@ }; $\C{// same enumerator names}$
    1616\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 include files.
     17There 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.
    1818
    1919The \CFA type-system allows extensive overloading, including enumerators.
    2020Hence, 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-qualification, to disambiguate.
     21In addition, C Enum qualification is added, exactly like aggregate field qualification, to disambiguate.
    2222\VRef[Figure]{f:EnumeratorVisibility} shows how resolution, qualification, and casting are used to disambiguate situations for enumerations @E1@ and @E2@.
    2323
     
    6666As in Section~\ref{s:CVisibility}, opening multiple scoped enumerations in a @with@ can result in duplicate enumeration names, but \CFA implicit type resolution and explicit qualification/casting handle this localized scenario.
    6767
    68 A partially implemented extension to enumerator scoping is providing a combination of scoped and unscoped enumerators, using individual denotations, where @'^'@ means unscoped.
    69 \begin{cfa}
    70 enum E1 { @!@A, @^@B, C };
    71 enum E2 @!@ { @!@A, @^@B, C };
    72 \end{cfa}
    73 For @E1@, @A@ is scoped; @B@ and @C@ are unscoped.
    74 For @E2@, @A@ and @C@ are scoped; @B@ is unscoped.
    75 Finding a use case is important to justify completing this extension.
    76 
    7768
    7869\section{Type Safety}
     
    8071As in Section~\ref{s:Usage}, C's implicit bidirectional conversion between enumeration and integral type raises a safety concern.
    8172In \CFA, the conversion is changed to unidirectional: an enumeration can be implicitly converted into an integral type, with an associated @safe@ conversion cost.
    82 But an integral type cannot be implicitly converted into a C enumeration because the conversion cost is set to @infinity@.
     73However, an integral type cannot be implicitly converted into a C enumeration because the conversion cost is set to @infinity@.
    8374\begin{cfa}
    8475enum Bird { Penguin, Robin, Eagle };
Note: See TracChangeset for help on using the changeset viewer.