Changes in doc/user/user.tex [e229c22:0638c44]
- File:
-
- 1 edited
-
doc/user/user.tex (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
re229c22 r0638c44 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Fri Jun 3 09:49:31201614 %% Update Count : 2 8113 %% Last Modified On : Tue May 3 08:05:33 2016 14 %% Update Count : 246 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 30 30 \usepackage{textcomp} 31 31 \usepackage[latin1]{inputenc} 32 \usepackage{fullpage,times,comment} 32 \usepackage{upquote} 33 \usepackage{fullpage,times} 33 34 \usepackage{epic,eepic} 34 \usepackage{upquote} % switch curled `' to straight `'35 35 \usepackage{xspace} 36 \usepackage{varioref} % extended references 37 \usepackage{listings} % format program code 38 \usepackage{footmisc} % support label/reference in footnote 39 \usepackage{latexsym} % \Box glyph 36 \usepackage{varioref} 37 \usepackage{listings} 38 \usepackage{footmisc} 39 \usepackage{comment} 40 \usepackage{latexsym} % \Box 40 41 \usepackage{mathptmx} % better math font with "times" 41 42 \usepackage[pagewise]{lineno} … … 112 113 The syntax of the \CFA language builds from C, and should look immediately familiar to C programmers. 113 114 % Any language feature that is not described here can be assumed to be using the standard C11 syntax. 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.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. 115 116 Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global garbage-collection. 116 117 The primary new features include parametric-polymorphism routines and types, exceptions, concurrency, and modules. … … 243 244 The 1999 C standard plus GNU extensions. 244 245 \item\hspace*{-4pt}\Indexc{-fgnu89-¶inline¶}\index{compilation option!-fgnu89-inline@{©-fgnu89-¶inline¶©}} 245 Use the traditional GNU semantics for inline routines in C99 mode , which allows inline routines in header files.246 Use the traditional GNU semantics for inline routines in C99 mode. 246 247 \end{description} 247 248 The following new \CFA option is available: … … 1173 1174 Unfortunately, this restriction forces programmers to use ©goto© to achieve the equivalent for more than one level of nesting. 1174 1175 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}. 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 1176 For the labelled ©break©, it is possible to specify which control structure is the target for exit, as in: 1177 \begin{quote2} 1182 1178 \begin{tabular}{@{}l@{\hspace{30pt}}l@{}} 1183 1179 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ … … 1200 1196 ... goto L1; ... 1201 1197 ... goto L2; ... 1202 ... goto L3; // or break 1198 ... goto L3; // or break 1203 1199 } L3: ; 1204 1200 } L2: ; … … 1206 1202 \end{lstlisting} 1207 1203 \end{tabular} 1208 \caption{Labelled Break} 1209 \label{f:LabelledBreak} 1210 1211 \vspace*{0.25in} 1212 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} 1213 1208 \begin{tabular}{@{}l@{\hspace{30pt}}l@{}} 1214 1209 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ … … 1219 1214 ... continue ®L1®; ... 1220 1215 ... continue ®L2®; ... 1221 ... continue ®L3®; // or continue1216 ... continue ®L3®; ... 1222 1217 1223 1218 } … … 1234 1229 ... goto L1; ... 1235 1230 ... goto L2; ... 1236 ... goto L3; // or continue1231 ... goto L3; ... 1237 1232 L3: ; 1238 1233 } … … 1243 1238 \end{lstlisting} 1244 1239 \end{tabular} 1245 \caption{Labelled Continue} 1246 \label{f:LabelledContinue} 1247 \end{figure} 1248 1240 \end{quote2} 1241 The inner most loop has three restart points, which cause the next loop iteration to begin, respectively. 1249 1242 For both ©break© and ©continue©, the target label must be directly associated with a ©for©, ©while© or ©do© statement; 1250 1243 for ©break©, the target label can also be associated with a ©switch© statement. … … 3336 3329 \begin{lstlisting} 3337 3330 struct Line { 3338 float l nth;3331 float length; 3339 3332 } 3340 3333 // default constructor 3341 3334 void ?{}( Line * l ) { 3342 l->lnth = 0.0;3343 3335 sout | "default" | endl; 3336 l.length = 0.0; 3344 3337 } 3345 3338 3346 3339 3347 3340 // constructor with length 3348 void ?{}( Line * l, float l nth ) {3349 l->lnth = lnth;3350 sout | "lnth" | l->lnth | endl; 3351 3341 void ?{}( Line * l, float length ) { 3342 sout | "length" | length | endl; 3343 3344 l.length = length; 3352 3345 } 3353 3346 3354 3347 // destructor 3355 void ^?( ) {3348 void ^?(Line &l) { 3356 3349 sout | "destroyed" | endl; 3357 l.l nth = 0.0;3350 l.length = 0.0; 3358 3351 } 3359 3352 3360 3353 // usage 3361 3354 Line line1; 3362 Line line2 ={ 3.4 };3355 Line line2{ 3.4 }; 3363 3356 \end{lstlisting} 3364 3357 & 3365 3358 \begin{lstlisting}[language=C++] 3366 3359 class Line { 3367 float l nth;3360 float length; 3368 3361 3369 3362 // default constructor 3370 3363 Line() { 3371 3364 cout << "default" << endl; 3372 l nth = 0.0;3365 length = 0.0; 3373 3366 } 3374 3367 3375 3368 3376 // constructor with l nth3369 // constructor with length 3377 3370 Line( float l ) { 3378 3371 cout << "length " << length
Note:
See TracChangeset
for help on using the changeset viewer.