Changeset e229c22 for doc/user/user.tex
- Timestamp:
- Jun 4, 2016, 12:34:24 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 57aa6f5, b8387fc
- Parents:
- 31eed869
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
r31eed869 re229c22 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Tue May 3 08:05:33201614 %% Update Count : 2 4613 %% Last Modified On : Fri Jun 3 09:49:31 2016 14 %% Update Count : 281 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 30 30 \usepackage{textcomp} 31 31 \usepackage[latin1]{inputenc} 32 \usepackage{upquote} 33 \usepackage{fullpage,times} 32 \usepackage{fullpage,times,comment} 34 33 \usepackage{epic,eepic} 34 \usepackage{upquote} % switch curled `' to straight `' 35 35 \usepackage{xspace} 36 \usepackage{varioref} 37 \usepackage{listings} 38 \usepackage{footmisc} 39 \usepackage{comment} 40 \usepackage{latexsym} % \Box 36 \usepackage{varioref} % extended references 37 \usepackage{listings} % format program code 38 \usepackage{footmisc} % support label/reference in footnote 39 \usepackage{latexsym} % \Box glyph 41 40 \usepackage{mathptmx} % better math font with "times" 42 41 \usepackage[pagewise]{lineno} … … 113 112 The syntax of the \CFA language builds from C, and should look immediately familiar to C programmers. 114 113 % Any language feature that is not described here can be assumed to be using the standard C11 syntax. 115 \CFA adds many modern programming-language features , which directly leads to increased safety and productivity, while maintaining interoperability with existing C programs and achieving C performance.114 \CFA adds many modern programming-language features that directly leads to increased \emph{safety} and \emph{productivity}, while maintaining interoperability with existing C programs and achieving C performance. 116 115 Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global garbage-collection. 117 116 The primary new features include parametric-polymorphism routines and types, exceptions, concurrency, and modules. … … 244 243 The 1999 C standard plus GNU extensions. 245 244 \item\hspace*{-4pt}\Indexc{-fgnu89-¶inline¶}\index{compilation option!-fgnu89-inline@{©-fgnu89-¶inline¶©}} 246 Use the traditional GNU semantics for inline routines in C99 mode .245 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files. 247 246 \end{description} 248 247 The following new \CFA option is available: … … 1174 1173 Unfortunately, this restriction forces programmers to use ©goto© to achieve the equivalent for more than one level of nesting. 1175 1174 To prevent having to make this switch, the ©break© and ©continue© are extended with a target label to support static multi-level exit~\cite{Buhr85,Java}. 1176 For the labelled ©break©, it is possible to specify which control structure is the target for exit, as in: 1177 \begin{quote2} 1175 \VRef[Figure]{f:LabelledBreak} shows the labelled ©break©, and the target control structure of the exit. 1176 The inner most loop has three exit points, which cause termination of one or more of the three nested loops, respectively. 1177 \VRef[Figure]{f:LabelledContinue} shows the labelled ©continue©, and which control structure is the target of the next loop iteration. 1178 The inner most loop has three restart points, which cause the next loop iteration to begin, respectively. 1179 1180 \begin{figure} 1181 \centering 1178 1182 \begin{tabular}{@{}l@{\hspace{30pt}}l@{}} 1179 1183 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ … … 1196 1200 ... goto L1; ... 1197 1201 ... goto L2; ... 1198 ... goto L3; // or break 1202 ... goto L3; // or break 1199 1203 } L3: ; 1200 1204 } L2: ; … … 1202 1206 \end{lstlisting} 1203 1207 \end{tabular} 1204 \end{quote2} 1205 The inner most loop has three exit points, which cause termination of one or more of the three nested loops, respectively. 1206 For the labelled ©continue©, it is possible to specify which control structure is the target for the next loop iteration, as in: 1207 \begin{quote2} 1208 \caption{Labelled Break} 1209 \label{f:LabelledBreak} 1210 1211 \vspace*{0.25in} 1212 1208 1213 \begin{tabular}{@{}l@{\hspace{30pt}}l@{}} 1209 1214 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ … … 1214 1219 ... continue ®L1®; ... 1215 1220 ... continue ®L2®; ... 1216 ... continue ®L3®; ...1221 ... continue ®L3®; // or continue 1217 1222 1218 1223 } … … 1229 1234 ... goto L1; ... 1230 1235 ... goto L2; ... 1231 ... goto L3; ...1236 ... goto L3; // or continue 1232 1237 L3: ; 1233 1238 } … … 1238 1243 \end{lstlisting} 1239 1244 \end{tabular} 1240 \end{quote2} 1241 The inner most loop has three restart points, which cause the next loop iteration to begin, respectively. 1245 \caption{Labelled Continue} 1246 \label{f:LabelledContinue} 1247 \end{figure} 1248 1242 1249 For both ©break© and ©continue©, the target label must be directly associated with a ©for©, ©while© or ©do© statement; 1243 1250 for ©break©, the target label can also be associated with a ©switch© statement. … … 3329 3336 \begin{lstlisting} 3330 3337 struct Line { 3331 float l ength;3338 float lnth; 3332 3339 } 3333 3340 // default constructor 3334 3341 void ?{}( Line * l ) { 3342 l->lnth = 0.0; 3335 3343 sout | "default" | endl; 3336 l.length = 0.0;3337 3344 } 3338 3345 3339 3346 3340 3347 // constructor with length 3341 void ?{}( Line * l, float l ength ) {3342 sout | "length" | length | endl;3343 3344 l.length = length; 3348 void ?{}( Line * l, float lnth ) { 3349 l->lnth = lnth; 3350 sout | "lnth" | l->lnth | endl; 3351 3345 3352 } 3346 3353 3347 3354 // destructor 3348 void ^?( Line &l) {3355 void ^?() { 3349 3356 sout | "destroyed" | endl; 3350 l.l ength = 0.0;3357 l.lnth = 0.0; 3351 3358 } 3352 3359 3353 3360 // usage 3354 3361 Line line1; 3355 Line line2 { 3.4 };3362 Line line2 = { 3.4 }; 3356 3363 \end{lstlisting} 3357 3364 & 3358 3365 \begin{lstlisting}[language=C++] 3359 3366 class Line { 3360 float l ength;3367 float lnth; 3361 3368 3362 3369 // default constructor 3363 3370 Line() { 3364 3371 cout << "default" << endl; 3365 l ength = 0.0;3372 lnth = 0.0; 3366 3373 } 3367 3374 3368 3375 3369 // constructor with l ength3376 // constructor with lnth 3370 3377 Line( float l ) { 3371 3378 cout << "length " << length
Note: See TracChangeset
for help on using the changeset viewer.