- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/CFAenum.tex
r29c8675 rd93b813 147 147 const T E_values [3] = { t1, t2, t3 }; 148 148 \end{cfa} 149 The generated C enumeration will have enumerator values equals to their positions thanks to C's auto-initialization scheme. Notice that value and label arrays are dynamically allocated data structures that take up 149 The generated C enumeration will have enumerator values resemble \CFA enumerator positions thanks to C's auto-initialization scheme. 150 A \CFA enumeration variable definition is same in \CFA and C, before or after the transpilation. 151 For example: 152 \begin{cfa} 153 enum E e = E1; 154 e; 155 \end{cfa} 156 These two expressions will not change by \CFA-cc. A \CFA enumeration variable will always have the same underlying representation as its generated 157 C enumeration. This implies \CFA enumeration variable does not take up extra memory and \CFA enumeration use @posn@ as its underlying representation. 158 159 Notice that value and label arrays are dynamically allocated data structures that take up 150 160 memory. If an enumeration is globally defined, the arrays are allocated in the @.data@ section and will be initialized before the program execution. 151 161 Otherwise, if an enumeration has its definition in a local scope, these arrays will be allocated on the stack and be initialized when the program counter … … 212 222 213 223 214 \section{ AutoInitialization}224 \section{Initialization} 215 225 \CFA extends C's auto-initialization scheme to \CFA enumeration. For an enumeration type with base type T, the initialization scheme is the following: 216 226 \begin{enumerate}
Note: See TracChangeset
for help on using the changeset viewer.