Changeset fbfde843 for doc/user/user.tex
- Timestamp:
- May 2, 2016, 3:15:07 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:
- d7903b1
- Parents:
- 540de412 (diff), e945826 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
r540de412 rfbfde843 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Apr 21 08:15:37201614 %% Update Count : 13113 %% Last Modified On : Sat Apr 30 13:54:32 2016 14 %% Update Count : 221 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 17 17 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended 18 19 % red highlighting ®...® (registered trademark sumbol) 20 % blue highlighting ©...© (copyright symbol) 21 % latex escape §...§ (section symbol) 22 % keyword escape ¶...¶ (pilcrow symbol) 23 % math escape $...$ (dollar symbol) 18 24 19 25 \documentclass[openright,twoside]{article} … … 226 232 227 233 228 \section {Compiling \CFA Program}234 \section[Compiling CFA Program]{Compiling \CFA Program} 229 235 230 236 The command \lstinline@cfa@ is used to compile \CFA program(s). 231 237 This command works like the GNU \lstinline@gcc@\index{gcc} command, e.g.: 232 238 \begin{lstlisting} 233 cfa [ gcc-options ] C/ @{\CFA}@-files [ assembler/loader-files ]234 \end{lstlisting} 235 \index {cfa@\lstinline$cfa$}\index{compilation!cfa@\lstinline$cfa$}239 cfa [ gcc-options ] C/§\CFA§-files [ assembler/loader-files ] 240 \end{lstlisting} 241 \indexc{cfa}\index{compilation!cfa@\lstinline$cfa$} 236 242 By default, \CFA programs having the following \lstinline@gcc@ flags turned on: 237 243 \begin{description} 238 \item 239 \hspace*{-4pt}\lstinline@-std=gnu99@ 240 \index{-std=gnu99@{\lstinline$-std=gnu99$}}\index{compilation option!-std=gnu99@{\lstinline$-std=gnu99$}} 244 \item\hspace*{-4pt}\Indexc{-std=gnu99}\index{compilation option!-std=gnu99@{\lstinline$-std=gnu99$}} 241 245 The 1999 C standard plus GNU extensions. 242 \item 243 \hspace*{-4pt}\lstinline@-fgnu89-inline@ 244 \index{-fgnu89-inline@{\lstinline$-fgnu89-inline$}}\index{compilation option!-fgnu89-inline@{\lstinline$-fgnu89-inline$}} 246 \item\hspace*{-4pt}\Indexc{-fgnu89-¶inline¶}\index{compilation option!-fgnu89-inline@{\lstinline$-fgnu89-¶inline¶$}} 245 247 Use the traditional GNU semantics for inline routines in C99 mode. 246 248 \end{description} 247 249 The following new \CFA option is available: 248 250 \begin{description} 249 \item 250 \hspace*{-4pt}\lstinline@-CFA@ 251 \index{-CFA@{\lstinline$-CFA$}}\index{compilation option!-CFA@{\lstinline$-CFA$}} 251 \item\hspace*{-4pt}\Indexc{-CFA}\index{compilation option!-CFA@{\lstinline$-CFA$}} 252 252 Only the C preprocessor and the \CFA translator steps are performed and the transformed program is written to standard output, which makes it possible to examine the code generated by the \CFA translator. 253 253 \end{description} … … 255 255 The following preprocessor variables are available: 256 256 \begin{description} 257 \item 258 \hspace*{-4pt}\lstinline$__CFA__$ 259 \index{__CFA__@{\lstinline$__CFA__$}}\index{preprocessor variables!__CFA__@{\lstinline$__CFA__$}} 257 \item\hspace*{-4pt}\Indexc{__CFA__}\index{preprocessor variables!__CFA__@{\lstinline$__CFA__$}} 260 258 is always available during preprocessing and its value is the current major \Index{version number} of \CFA.\footnote{ 261 259 The C preprocessor allows only integer values in a preprocessor variable so a value like ``\Version'' is not allowed. 262 260 Hence, the need to have three variables for the major, minor and patch version number.} 263 261 264 \item 265 \hspace*{-4pt}\lstinline$__CFA_MINOR__$ 266 \index{__CFA_MINOR__@{\lstinline$__CFA_MINOR__$}}\index{preprocessor variables!__CFA_MINOR__@{\lstinline$__CFA_MINOR__$}} 262 \item\hspace*{-4pt}\Indexc{__CFA_MINOR__}\index{preprocessor variables!__CFA_MINOR__@{\lstinline$__CFA_MINOR__$}} 267 263 is always available during preprocessing and its value is the current minor \Index{version number} of \CFA. 268 264 269 \item 270 \hspace*{-4pt}\lstinline$__CFA_PATCH__$ 271 \index{__CFA_PATCH__@%(__CFA_PATCH__%)}\index{preprocessor variables!__CFA_PATCH__@%(__CFA_PATCH__%)} 265 \item\hspace*{-4pt}\Indexc{__CFA_PATCH__}\index{preprocessor variables!__CFA_PATCH__@\lstinline$__CFA_PATCH__$} 272 266 is always available during preprocessing and its value is the current patch \Index{version number} of \CFA. 273 267 274 \item 275 \hspace*{-4pt}\lstinline$__CFORALL__$ 276 \index{__CFORALL__@%(__CFORALL__%)}\index{preprocessor variables!__CFORALL__@%(__CFORALL__%)} 268 \item\hspace*{-4pt}\Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@\lstinline$__CFORALL__$} 277 269 is always available during preprocessing and it has no value. 278 270 \end{description} … … 282 274 \begin{lstlisting} 283 275 #ifndef __CFORALL__ 284 #include <stdio.h> // C header file276 #include <stdio.h> // C header file 285 277 #else 286 #include <fstream> // @\CFA{}@header file278 #include <fstream> // §\CFA{}§ header file 287 279 #endif 288 280 \end{lstlisting} … … 294 286 Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, e.g.: 295 287 \begin{lstlisting} 296 2 `_`147`_`483`_`648; // decimal constant288 2®_®147®_®483®_®648; // decimal constant 297 289 56_ul; // decimal unsigned long constant 298 290 0_377; // octal constant … … 360 352 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 361 353 \begin{lstlisting} 362 `* int x, y;` 354 ®* int x, y;® 363 355 \end{lstlisting} 364 356 & … … 488 480 The point of the new syntax is to allow returning multiple values from a routine~\cite{CLU,Galletly96}, e.g.: 489 481 \begin{lstlisting} 490 `[ int o1, int o2, char o3 ]`f( int i1, char i2, char i3 ) {491 @\emph{routine body}@482 ®[ int o1, int o2, char o3 ]® f( int i1, char i2, char i3 ) { 483 §\emph{routine body}§ 492 484 } 493 485 \end{lstlisting} … … 500 492 Declaration qualifiers can only appear at the start of a routine definition, e.g.: 501 493 \begin{lstlisting} 502 extern [ int x ] g( int y ) { @\,@}494 extern [ int x ] g( int y ) {§\,§} 503 495 \end{lstlisting} 504 496 Lastly, if there are no output parameters or input parameters, the brackets and/or parentheses must still be specified; 505 497 in both cases the type is assumed to be void as opposed to old style C defaults of int return type and unknown parameter types, respectively, as in: 506 498 \begin{lstlisting} 507 [ @\,@] g(@\,@);// no input or output parameters499 [§\,§] g(); // no input or output parameters 508 500 [ void ] g( void ); // no input or output parameters 509 501 \end{lstlisting} … … 556 548 Because the value in the return variable is automatically returned when a \CFA routine terminates, the \lstinline@return@ statement \emph{does not} contain an expression, as in: 557 549 \begin{lstlisting} 558 `[ int x ]`f() {550 ®[ int x ]® f() { 559 551 ... x = 0; ... x = y; ... 560 `return;`// implicitly return x552 ®return;® // implicitly return x 561 553 } 562 554 \end{lstlisting} … … 781 773 \subsection{Type Nesting} 782 774 783 \CFA allows \Index{type nesting}, and type qualification of the nested types, where as C hoists\index{type !hoisting} (refactors) nested types into the enclosing scope and has no type qualification.775 \CFA allows \Index{type nesting}, and type qualification of the nested types, where as C hoists\index{type hoisting} (refactors) nested types into the enclosing scope and has no type qualification. 784 776 \begin{quote2} 785 777 \begin{tabular}{@{}l@{\hspace{30pt}}l|l@{}} … … 836 828 837 829 int fred() { 838 s.t.c = `S.`R; // type qualification839 struct `S.`T t = { `S.`R, 1, 2 };840 enum `S.`C c;841 union `S.T.`U u;830 s.t.c = ®S.®R; // type qualification 831 struct ®S.®T t = { ®S.®R, 1, 2 }; 832 enum ®S.®C c; 833 union ®S.T.®U u; 842 834 } 843 835 \end{lstlisting} … … 863 855 qsort( ia, size ); // sort ascending order using builtin ?<? 864 856 { 865 `int ?<?( int x, int y ) { return x > y; }`// nested routine857 ®int ?<?( int x, int y ) { return x > y; }® // nested routine 866 858 qsort( ia, size ); // sort descending order by local redefinition 867 859 } … … 873 865 \begin{lstlisting} 874 866 [* [int]( int )] foo() { // int (*foo())( int ) 875 int `i`= 7;867 int ®i® = 7; 876 868 int bar( int p ) { 877 `i`+= 1; // dependent on local variable878 sout | `i`| endl;869 ®i® += 1; // dependent on local variable 870 sout | ®i® | endl; 879 871 } 880 872 return bar; // undefined because of local dependence … … 897 889 The general syntax of a tuple is: 898 890 \begin{lstlisting} 899 [ $\emph{exprlist}$]891 [ §\emph{exprlist}§ ] 900 892 \end{lstlisting} 901 893 where \lstinline@$\emph{exprlist}$@ is a list of one or more expressions separated by commas. … … 917 909 The general syntax of a tuple type is: 918 910 \begin{lstlisting} 919 [ @\emph{typelist}@]911 [ §\emph{typelist}§ ] 920 912 \end{lstlisting} 921 913 where \lstinline@$\emph{typelist}$@ is a list of one or more legal \CFA or C type specifications separated by commas, which may include other tuple type specifications. … … 1047 1039 Mass assignment has the following form: 1048 1040 \begin{lstlisting} 1049 [ @\emph{lvalue}@, ..., @\emph{lvalue}@ ] = @\emph{expr}@;1050 \end{lstlisting} 1051 The left-hand side is a tuple of \ lstinline@$\emph{lvalues}$@, which is a list of expressions each yielding an address, i.e., any data object that can appear on the left-hand side of a conventional assignment statement.1041 [ §\emph{lvalue}§, ..., §\emph{lvalue}§ ] = §\emph{expr}§; 1042 \end{lstlisting} 1043 The left-hand side is a tuple of \emph{lvalues}, which is a list of expressions each yielding an address, i.e., any data object that can appear on the left-hand side of a conventional assignment statement. 1052 1044 \lstinline@$\emph{expr}$@ is any standard arithmetic expression. 1053 1045 Clearly, the types of the entities being assigned must be type compatible with the value of the expression. … … 1086 1078 Multiple assignment has the following form: 1087 1079 \begin{lstlisting} 1088 [ @\emph{lvalue}@, . . ., @\emph{lvalue}@ ] = [ @\emph{expr}@, . . ., @\emph{expr}@];1089 \end{lstlisting} 1090 The left-hand side is a tuple of \ lstinline@$\emph{lvalues}$@, and the right-hand side is a tuple of \lstinline@$\emph{expr}$@s.1091 Each \ lstinline@$\emph{expr}$@ appearing on the righthand side of a multiple assignment statement is assigned to the corresponding \lstinline@$\emph{lvalues}$@on the left-hand side of the statement using parallel semantics for each assignment.1080 [ §\emph{lvalue}§, . . ., §\emph{lvalue}§ ] = [ §\emph{expr}§, . . ., §\emph{expr}§ ]; 1081 \end{lstlisting} 1082 The left-hand side is a tuple of \emph{lvalues}, and the right-hand side is a tuple of \emph{expr}s. 1083 Each \emph{expr} appearing on the righthand side of a multiple assignment statement is assigned to the corresponding \emph{lvalues} on the left-hand side of the statement using parallel semantics for each assignment. 1092 1084 An example of multiple assignment is: 1093 1085 \begin{lstlisting} … … 1126 1118 Cascade assignment has the following form: 1127 1119 \begin{lstlisting} 1128 @\emph{tuple}@ = @\emph{tuple}@ = ... = @\emph{tuple}@;1120 §\emph{tuple}§ = §\emph{tuple}§ = ... = §\emph{tuple}§; 1129 1121 \end{lstlisting} 1130 1122 and it has the same parallel semantics as for mass and multiple assignment. … … 1144 1136 Its general form is: 1145 1137 \begin{lstlisting} 1146 @\emph{expr}@ . [ @\emph{fieldlist}@]1147 @\emph{expr}@ -> [ @\emph{fieldlist}@]1148 \end{lstlisting} 1149 \ lstinline@$\emph{expr}$@is any expression yielding a value of type record, e.g., \lstinline@struct@, \lstinline@union@.1150 Each element of \ lstinline@$\emph{ fieldlist}$@ is an element of the record specified by \lstinline@$\emph{expr}$@.1138 §\emph{expr}§ . [ §\emph{fieldlist}§ ] 1139 §\emph{expr}§ -> [ §\emph{fieldlist}§ ] 1140 \end{lstlisting} 1141 \emph{expr} is any expression yielding a value of type record, e.g., \lstinline@struct@, \lstinline@union@. 1142 Each element of \emph{ fieldlist} is an element of the record specified by \emph{expr}. 1151 1143 A record-field tuple may be used anywhere a tuple can be used. An example of the use of a record-field tuple is 1152 1144 the following: … … 1188 1180 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1189 1181 \begin{lstlisting} 1190 `L1:`for ( ... ) {1191 `L2:`for ( ... ) {1192 `L3:`for ( ... ) {1193 ... break `L1`; ...1194 ... break `L2`; ...1195 ... break `L3`; // or break1182 ®L1:® for ( ... ) { 1183 ®L2:® for ( ... ) { 1184 ®L3:® for ( ... ) { 1185 ... break ®L1®; ... 1186 ... break ®L2®; ... 1187 ... break ®L3®; // or break 1196 1188 } 1197 1189 } … … 1218 1210 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1219 1211 \begin{lstlisting} 1220 `L1`: for ( ... ) {1221 `L2`: for ( ... ) {1222 `L3`: for ( ... ) {1223 ... continue `L1`; ...1224 ... continue `L2`; ...1225 ... continue `L3`; ...1212 ®L1®: for ( ... ) { 1213 ®L2®: for ( ... ) { 1214 ®L3®: for ( ... ) { 1215 ... continue ®L1®; ... 1216 ... continue ®L2®; ... 1217 ... continue ®L3®; ... 1226 1218 1227 1219 } … … 1459 1451 \begin{lstlisting} 1460 1452 switch ( i ) { 1461 `case 1, 3, 5`:1453 ®case 1, 3, 5®: 1462 1454 ... 1463 `case 2, 4, 6`:1455 ®case 2, 4, 6®: 1464 1456 ... 1465 1457 } … … 1491 1483 \begin{lstlisting} 1492 1484 switch ( i ) { 1493 `case 1~5:`1485 ®case 1~5:® 1494 1486 ... 1495 `case 10~15:`1487 ®case 10~15:® 1496 1488 ... 1497 1489 } … … 2048 2040 For example, given 2049 2041 \begin{lstlisting} 2050 auto j = `...`2042 auto j = ®...® 2051 2043 \end{lstlisting} 2052 2044 and the need to write a routine to compute using \lstinline@j@ 2053 2045 \begin{lstlisting} 2054 void rtn( `...`parm );2046 void rtn( ®...® parm ); 2055 2047 rtn( j ); 2056 2048 \end{lstlisting} … … 2372 2364 To make this work, a space is required after the field selection: 2373 2365 \begin{lstlisting} 2374 `s.@\textvisiblespace@0`= 0;2375 `s.@\textvisiblespace@1`= 1;2366 ®s.§\textvisiblespace§0® = 0; 2367 ®s.§\textvisiblespace§1® = 1; 2376 2368 \end{lstlisting} 2377 2369 While this sytact is awkward, it is unlikely many programers will name fields of a structure 0 or 1. 2378 Like the \CC lexical problem with closing template-syntax, e.g, \lstinline@Foo<Bar<int `>>`@, this issue can be solved with a more powerful lexer/parser.2370 Like the \CC lexical problem with closing template-syntax, e.g, \lstinline@Foo<Bar<int®>>®@, this issue can be solved with a more powerful lexer/parser. 2379 2371 2380 2372 There are several ambiguous cases with operator identifiers, e.g., \lstinline@int *?*?()@, where the string \lstinline@*?*?@ can be lexed as \lstinline@*@/\lstinline@?*?@ or \lstinline@*?@/\lstinline@*?@. … … 2383 2375 The first case is for the function-call identifier \lstinline@?()@: 2384 2376 \begin{lstlisting} 2385 int * @\textvisiblespace@?()(); // declaration: space required after '*'2386 * @\textvisiblespace@?()(); // expression: space required after '*'2377 int *§\textvisiblespace§?()(); // declaration: space required after '*' 2378 *§\textvisiblespace§?()(); // expression: space required after '*' 2387 2379 \end{lstlisting} 2388 2380 Without the space, the string \lstinline@*?()@ is ambiguous without N character look ahead; … … 2391 2383 The 4 remaining cases occur in expressions: 2392 2384 \begin{lstlisting} 2393 i++ @\textvisiblespace@?i:0; // space required before '?'2394 i-- @\textvisiblespace@?i:0; // space required before '?'2395 i @\textvisiblespace@?++i:0; // space required after '?'2396 i @\textvisiblespace@?--i:0; // space required after '?'2385 i++§\textvisiblespace§?i:0; // space required before '?' 2386 i--§\textvisiblespace§?i:0; // space required before '?' 2387 i§\textvisiblespace§?++i:0; // space required after '?' 2388 i§\textvisiblespace§?--i:0; // space required after '?' 2397 2389 \end{lstlisting} 2398 2390 In the first two cases, the string \lstinline@i++?@ is ambiguous, where this string can be lexed as \lstinline@i@ / \lstinline@++?@ or \lstinline@i++@ / \lstinline@?@; … … 3325 3317 3326 3318 3327 \subsection {Comparing Key Features of \CFA}3319 \subsection[Comparing Key Features of CFA]{Comparing Key Features of \CFA} 3328 3320 3329 3321 … … 3699 3691 3700 3692 \begin{comment} 3701 \subsubsection{Modules /Packages}3693 \subsubsection{Modules / Packages} 3702 3694 3703 3695 \begin{lstlisting} … … 3941 3933 3942 3934 3943 \subsubsection {\CC}3935 \subsubsection[C++]{\CC} 3944 3936 3945 3937 \CC is a general-purpose programming language. … … 4079 4071 Given that nested types in C are equivalent to not using them, i.e., they are essentially useless, it is unlikely there are any realistic usages that break because of this incompatibility. 4080 4072 4081 4082 4073 \item 4083 4074 Change: In C++, the name of a nested class is local to its enclosing class. … … 4090 4081 struct Y yy; // valid C, invalid C++ 4091 4082 \end{lstlisting} 4092 Rationale: C++ classes have member functions which require that classes establish scopes. The C rule 4093 would leave classes as an incomplete scope mechanism which would prevent C++ programmers from maintaining 4094 locality within a class. A coherent set of scope rules for C++ based on the C rule would be very 4095 complicated and C++ programmers would be unable to predict reliably the meanings of nontrivial examples 4096 involving nested or local functions. 4097 Effect on original feature: Change of semantics of welldefined 4098 feature. 4099 Difficulty of converting: Semantic transformation. To make the struct type name visible in the scope of 4100 the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing 4101 struct is defined. Example: 4083 Rationale: C++ classes have member functions which require that classes establish scopes. 4084 The C rule would leave classes as an incomplete scope mechanism which would prevent C++ programmers from maintaining locality within a class. A coherent set of scope rules for C++ based on the C rule would be very complicated and C++ programmers would be unable to predict reliably the meanings of nontrivial examples involving nested or local functions. 4085 Effect on original feature: Change of semantics of welldefined feature. 4086 Difficulty of converting: Semantic transformation. To make the struct type name visible in the scope of the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing struct is defined. Example: 4102 4087 \begin{lstlisting} 4103 4088 struct Y; // struct Y and struct X are at the same scope … … 4106 4091 }; 4107 4092 \end{lstlisting} 4108 All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of 4109 the enclosing struct could be exported to the scope of the enclosing struct. Note: this is a consequence of 4110 the difference in scope rules, which is documented in 3.3. 4093 All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of the enclosing struct could be exported to the scope of the enclosing struct. 4094 Note: this is a consequence of the difference in scope rules, which is documented in 3.3. 4111 4095 How widely used: Seldom. 4112 4096 \end{enumerate} … … 4124 4108 \begin{lstlisting} 4125 4109 int x = 0, y = 1, z = 2; 4126 `sout` `|` x `|` y `|` z `| endl`;4110 ®sout® ®|® x ®|® y ®|® z ®| endl®; 4127 4111 \end{lstlisting} 4128 4112 & … … 4133 4117 \end{tabular} 4134 4118 \end{quote2} 4135 The \CFA form is half as many characters, and is similar to PythonI/O with respect to implicit separators.4119 The \CFA form is half as many characters, and is similar to \Index{Python} I/O with respect to implicit separators. 4136 4120 4137 4121 The logical-or operator is used because it is the lowest-priority overloadable operator, other than assignment. … … 4160 4144 A seperator does not appear at the start or end of a line. 4161 4145 \begin{lstlisting}[belowskip=0pt] 4162 sout 1 | 2 | 3 | endl;4146 sout | 1 | 2 | 3 | endl; 4163 4147 \end{lstlisting} 4164 4148 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4179 4163 which is a local mechanism to disable insertion of the separator character. 4180 4164 \item 4181 A seperator does not appear before a C string starting with the \Index{extended ASCII}\index{ASCII} characters: \lstinline[mathescape=off]@([{$£¥¿«@4165 A seperator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{$£¥¡¿«@ 4182 4166 %$ 4183 4167 \begin{lstlisting}[mathescape=off] 4184 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¿" | 7 | "x «" | 8| endl;4168 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7 | "x ¿" | 8 | "x «" | 9 | endl; 4185 4169 \end{lstlisting} 4186 4170 %$ 4187 4171 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] 4188 x (1 x [2 x {3 x $4 x £5 x ¥6 x ¿7 x «84172 x (1 x [2 x {3 x $4 x £5 x ¥6 x ¡7 x ¿8 x «9 4189 4173 \end{lstlisting} 4190 4174 %$ 4191 4175 \item 4192 A seperator does not appear after a C string ending with the extended ASCIIcharacters: \lstinline@,.:;!?)]}%¢»@4176 A seperator does not appear after a C string ending with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline@,.:;!?)]}%¢»@ 4193 4177 \begin{lstlisting}[belowskip=0pt] 4194 4178 sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | ") x" | 8 | "] x" | 9 | "} x" 4195 | 10 | "% x" | 11 | L"¢ x" | 12 | L"» x" | endl;4179 | 10 | "% x" | 11 | "¢ x" | 12 | "» x" | endl; 4196 4180 \end{lstlisting} 4197 4181 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4199 4183 \end{lstlisting} 4200 4184 \item 4201 A seperator does not appear before or after a C string begining/ending with the characters: \lstinline@\f\n\r\t\v\`'"@4185 A seperator does not appear before or after a C string begining/ending with the \Index{ASCII} quote or whitespace characters: \lstinline[showspaces=true]@`'" \t\v\f\r\n@ 4202 4186 \begin{lstlisting}[belowskip=0pt] 4203 sout | "x '" | 1 | "' x \`" | 2 | "\` x \"" | 3 | "\" x" | endl; 4204 \end{lstlisting} 4205 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] 4206 x '1' x \`2\` x "3" x 4207 \end{lstlisting} 4208 \begin{lstlisting}[showtabs=true,aboveskip=0pt] 4209 sout | "x\t" | 1 | "\tx" | endl; 4210 x 1 x 4187 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | "x\t" | 1 | "\tx" | endl; 4188 \end{lstlisting} 4189 \begin{lstlisting}[mathescape=off,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt] 4190 x`1`x'2'x"3"x x 4 x x 1 x 4211 4191 \end{lstlisting} 4212 4192 \end{enumerate} … … 4240 4220 \end{lstlisting} 4241 4221 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] 4242 1 2 34222 1 2 3 4243 4223 \end{lstlisting} 4244 4224 \begin{lstlisting}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt] … … 4251 4231 \end{lstlisting} 4252 4232 %$ 4253 \VRef[Figure]{f:ExampleIO} shows an example of input and output I/O in \CFA. 4254 4255 \begin{figure} 4256 \begin{lstlisting}[mathescape=off] 4233 \begin{comment} 4257 4234 #include <fstream> 4258 4235 4259 4236 int main() { 4260 char c; // basic types 4261 short int si; 4262 unsigned short int usi; 4263 int i; 4264 unsigned int ui; 4265 long int li; 4266 unsigned long int uli; 4267 long long int lli; 4268 unsigned long long int ulli; 4269 float f; 4270 double d; 4271 long double ld; 4272 float _Complex fc; 4273 double _Complex dc; 4274 long double _Complex ldc; 4275 char s1[10], s2[10]; 4276 4277 ifstream in; // create / open file 4278 open( &in, "input.data", "r" ); 4279 4280 &in | &c // character 4281 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli // integral 4282 | &f | &d | &ld // floating point 4283 | &fc | &dc | &ldc // floating-point complex 4284 | cstr( s1 ) | cstr( s2, 10 ); // C string, length unchecked and checked 4285 4286 sout | c | ' ' | endl // character 4287 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 4288 | f | d | ld | endl // floating point 4289 | fc | dc | ldc | endl; // complex 4290 sout | endl; 4291 sout | f | "" | d | "" | ld | endl // floating point without separator 4292 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator 4293 | sepOn | s1 | sepOff | s2 | endl // local separator removal 4294 | s1 | "" | s2 | endl; // C string withou separator 4295 sout | endl; 4296 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 4297 sout | f | d | ld | endl // floating point without separator 4298 | fc | dc | ldc | endl // complex without separator 4299 | s1 | s2 | endl; 4300 } 4301 4302 $ cat input.data 4303 A 1 2 3 4 5 6 7 8 1.1 1.2 1.3 1.1+2.3 1.1-2.3 1.1-2.3 abc xyz 4304 $ a.out 4305 A 4306 1 2 3 4 5 6 7 8 4307 1.1 1.2 1.3 4308 1.1+2.3i 1.1-2.3i 1.1-2.3i 4309 4310 1.11.21.3 4311 1.1+2.3i1.1-2.3i1.1-2.3i 4312 abcxyz 4313 abcxyz 4314 4315 1.1, $1.2, $1.3 4316 1.1+2.3i, $1.1-2.3i, $1.1-2.3i 4317 abc, $xyz 4318 \end{lstlisting} 4319 \caption{Example I/O} 4320 \label{f:ExampleIO} 4321 \end{figure} 4237 int x = 3, y = 5, z = 7; 4238 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 4239 sout | 1 | 2 | 3 | endl; 4240 sout | '1' | '2' | '3' | endl; 4241 sout | 1 | "" | 2 | "" | 3 | endl; 4242 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7 | "x ¿" | 8 | "x «" | 9 | endl; 4243 sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | ") x" | 8 | "] x" | 9 | "} x" 4244 | 10 | "% x" | 11 | "¢ x" | 12 | "» x" | endl; 4245 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | "x\t" | 1 | "\tx" | endl; 4246 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start of line 4247 sout | 1 | sepOff | 2 | 3 | endl; // turn off implicit separator temporarily 4248 sout | sepDisable | 1 | 2 | 3 | endl; // turn off implicit separation, affects all subsequent prints 4249 sout | 1 | sepOn | 2 | 3 | endl; // turn on implicit separator temporarily 4250 sout | sepEnable | 1 | 2 | 3 | endl; // turn on implicit separation, affects all subsequent prints 4251 sepSet( sout, ", $" ); // change separator from " " to ", $" 4252 sout | 1 | 2 | 3 | endl; 4253 4254 } 4255 4256 // Local Variables: // 4257 // tab-width: 4 // 4258 // End: // 4259 \end{comment} 4260 %$ 4322 4261 4323 4262 … … 4331 4270 4332 4271 \begin{lstlisting} 4333 forall( otype T ) T * malloc( void ); 4272 forall( otype T ) T * malloc( void );§\indexc{malloc}§ 4334 4273 forall( otype T ) T * malloc( char fill ); 4335 4274 forall( otype T ) T * malloc( T * ptr, size_t size ); 4336 4275 forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ); 4337 forall( otype T ) T * calloc( size_t size );4338 forall( otype T ) T * realloc( T * ptr, size_t size ); 4276 forall( otype T ) T * calloc( size_t nmemb );§\indexc{calloc}§ 4277 forall( otype T ) T * realloc( T * ptr, size_t size );§\indexc{ato}§ 4339 4278 forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ); 4340 4279 4341 forall( otype T ) T * aligned_alloc( size_t alignment ); 4280 forall( otype T ) T * aligned_alloc( size_t alignment );§\indexc{ato}§ 4342 4281 forall( otype T ) T * memalign( size_t alignment ); // deprecated 4343 4282 forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ); … … 4348 4287 4349 4288 4350 \subsection{ato /strto}4351 4352 \begin{lstlisting} 4353 int ato( const char * ptr ); 4289 \subsection{ato / strto} 4290 4291 \begin{lstlisting} 4292 int ato( const char * ptr );§\indexc{ato}§ 4354 4293 unsigned int ato( const char * ptr ); 4355 4294 long int ato( const char * ptr ); … … 4379 4318 4380 4319 4381 \subsection{bsearch /qsort}4320 \subsection{bsearch / qsort} 4382 4321 4383 4322 \begin{lstlisting} 4384 4323 forall( otype T | { int ?<?( T, T ); } ) 4385 T * bsearch( const T key, const T * arr, size_t dimension ); 4324 T * bsearch( const T key, const T * arr, size_t dimension );§\indexc{bsearch}§ 4386 4325 4387 4326 forall( otype T | { int ?<?( T, T ); } ) 4388 void qsort( const T * arr, size_t dimension ); 4327 void qsort( const T * arr, size_t dimension );§\indexc{qsort}§ 4389 4328 \end{lstlisting} 4390 4329 … … 4393 4332 4394 4333 \begin{lstlisting} 4395 char abs( char ); 4396 extern "C" { 4397 int abs( int ); // use default C routine for int 4398 } // extern "C" 4334 char abs( char );§\indexc{abs}§ 4335 int abs( int ); 4399 4336 long int abs( long int ); 4400 4337 long long int abs( long long int ); … … 4402 4339 double abs( double ); 4403 4340 long double abs( long double ); 4404 float _Complex abs( float _Complex ); 4405 double _Complex abs( double _Complex ); 4406 long double _Complex abs( long double _Complex ); 4407 \end{lstlisting} 4408 4409 4410 \subsection{floor/ceil} 4411 4412 \begin{lstlisting} 4413 float floor( float ); 4414 extern "C" { 4415 double floor( double ); // use C routine for double 4416 } // extern "C" 4417 long double floor( long double ); 4418 4419 float ceil( float ); 4420 extern "C" { 4421 double ceil( double ); // use C routine for double 4422 } // extern "C" 4423 long double ceil( long double ); 4341 float abs( float _Complex ); 4342 double abs( double _Complex ); 4343 long double abs( long double _Complex ); 4424 4344 \end{lstlisting} 4425 4345 … … 4428 4348 4429 4349 \begin{lstlisting} 4430 void rand48seed( long int s ); 4431 char rand48(); 4350 void rand48seed( long int s );§\indexc{rand48seed}§ 4351 char rand48();§\indexc{rand48}§ 4432 4352 int rand48(); 4433 4353 unsigned int rand48(); … … 4442 4362 4443 4363 4444 \subsection{min /max/swap}4364 \subsection{min / max / swap} 4445 4365 4446 4366 \begin{lstlisting} 4447 4367 forall( otype T | { int ?<?( T, T ); } ) 4448 T min( const T t1, const T t2 ); 4368 T min( const T t1, const T t2 );§\indexc{min}§ 4449 4369 4450 4370 forall( otype T | { int ?>?( T, T ); } ) 4451 T max( const T t1, const T t2 ); 4371 T max( const T t1, const T t2 );§\indexc{max}§ 4452 4372 4453 4373 forall( otype T ) 4454 void swap( T * t1, T * t2 ); 4374 void swap( T * t1, T * t2 );§\indexc{swap}§ 4375 \end{lstlisting} 4376 4377 4378 \section{Math Library} 4379 \label{s:Math Library} 4380 4381 The goal of the \CFA math-library is to wrap many of the existing C math library-routines that are explicitly polymorphic into implicitly polymorphic versions. 4382 4383 4384 \subsection{General} 4385 4386 \begin{lstlisting} 4387 float fabs( float );§\indexc{fabs}§ 4388 double fabs( double ); 4389 long double fabs( long double ); 4390 float cabs( float _Complex ); 4391 double cabs( double _Complex ); 4392 long double cabs( long double _Complex ); 4393 4394 float ?%?( float, float );§\indexc{fmod}§ 4395 float fmod( float, float ); 4396 double ?%?( double, double ); 4397 double fmod( double, double ); 4398 long double ?%?( long double, long double ); 4399 long double fmod( long double, long double ); 4400 4401 float remainder( float, float );§\indexc{remainder}§ 4402 double remainder( double, double ); 4403 long double remainder( long double, long double ); 4404 4405 [ int, float ] remquo( float, float );§\indexc{remquo}§ 4406 float remquo( float, float, int * ); 4407 [ int, double ] remquo( double, double ); 4408 double remquo( double, double, int * ); 4409 [ int, long double ] remquo( long double, long double ); 4410 long double remquo( long double, long double, int * ); 4411 4412 [ int, float ] div( float, float ); // alternative name for remquo 4413 float div( float, float, int * );§\indexc{div}§ 4414 [ int, double ] div( double, double ); 4415 double div( double, double, int * ); 4416 [ int, long double ] div( long double, long double ); 4417 long double div( long double, long double, int * ); 4418 4419 float fma( float, float, float );§\indexc{fma}§ 4420 double fma( double, double, double ); 4421 long double fma( long double, long double, long double ); 4422 4423 float fdim( float, float );§\indexc{fdim}§ 4424 double fdim( double, double ); 4425 long double fdim( long double, long double ); 4426 4427 float nan( const char * );§\indexc{nan}§ 4428 double nan( const char * ); 4429 long double nan( const char * ); 4430 \end{lstlisting} 4431 4432 4433 \subsection{Exponential} 4434 4435 \begin{lstlisting} 4436 float exp( float );§\indexc{exp}§ 4437 double exp( double ); 4438 long double exp( long double ); 4439 float _Complex exp( float _Complex ); 4440 double _Complex exp( double _Complex ); 4441 long double _Complex exp( long double _Complex ); 4442 4443 float exp2( float );§\indexc{exp2}§ 4444 double exp2( double ); 4445 long double exp2( long double ); 4446 float _Complex exp2( float _Complex ); 4447 double _Complex exp2( double _Complex ); 4448 long double _Complex exp2( long double _Complex ); 4449 4450 float expm1( float );§\indexc{expm1}§ 4451 double expm1( double ); 4452 long double expm1( long double ); 4453 4454 float log( float );§\indexc{log}§ 4455 double log( double ); 4456 long double log( long double ); 4457 float _Complex log( float _Complex ); 4458 double _Complex log( double _Complex ); 4459 long double _Complex log( long double _Complex ); 4460 4461 float log2( float );§\indexc{log2}§ 4462 double log2( double ); 4463 long double log2( long double ); 4464 float _Complex log2( float _Complex ); 4465 double _Complex log2( double _Complex ); 4466 long double _Complex log2( long double _Complex ); 4467 4468 float log10( float );§\indexc{log10}§ 4469 double log10( double ); 4470 long double log10( long double ); 4471 float _Complex log10( float _Complex ); 4472 double _Complex log10( double _Complex ); 4473 long double _Complex log10( long double _Complex ); 4474 4475 float log1p( float );§\indexc{log1p}§ 4476 double log1p( double ); 4477 long double log1p( long double ); 4478 4479 int ilogb( float );§\indexc{ilogb}§ 4480 int ilogb( double ); 4481 int ilogb( long double ); 4482 4483 float logb( float );§\indexc{logb}§ 4484 double logb( double ); 4485 long double logb( long double ); 4486 \end{lstlisting} 4487 4488 4489 \subsection{Power} 4490 4491 \begin{lstlisting} 4492 float sqrt( float );§\indexc{sqrt}§ 4493 double sqrt( double ); 4494 long double sqrt( long double ); 4495 float _Complex sqrt( float _Complex ); 4496 double _Complex sqrt( double _Complex ); 4497 long double _Complex sqrt( long double _Complex ); 4498 4499 float cbrt( float );§\indexc{cbrt}§ 4500 double cbrt( double ); 4501 long double cbrt( long double ); 4502 4503 float hypot( float, float );§\indexc{hypot}§ 4504 double hypot( double, double ); 4505 long double hypot( long double, long double ); 4506 4507 float pow( float, float );§\indexc{pow}§ 4508 double pow( double, double ); 4509 long double pow( long double, long double ); 4510 float _Complex pow( float _Complex, float _Complex ); 4511 double _Complex pow( double _Complex, double _Complex ); 4512 long double _Complex pow( long double _Complex, long double _Complex ); 4513 \end{lstlisting} 4514 4515 4516 \subsection{Trigonometric} 4517 4518 \begin{lstlisting} 4519 float sin( float );§\indexc{sin}§ 4520 double sin( double ); 4521 long double sin( long double ); 4522 float _Complex sin( float _Complex ); 4523 double _Complex sin( double _Complex ); 4524 long double _Complex sin( long double _Complex ); 4525 4526 float cos( float );§\indexc{cos}§ 4527 double cos( double ); 4528 long double cos( long double ); 4529 float _Complex cos( float _Complex ); 4530 double _Complex cos( double _Complex ); 4531 long double _Complex cos( long double _Complex ); 4532 4533 float tan( float );§\indexc{tan}§ 4534 double tan( double ); 4535 long double tan( long double ); 4536 float _Complex tan( float _Complex ); 4537 double _Complex tan( double _Complex ); 4538 long double _Complex tan( long double _Complex ); 4539 4540 float asin( float );§\indexc{asin}§ 4541 double asin( double ); 4542 long double asin( long double ); 4543 float _Complex asin( float _Complex ); 4544 double _Complex asin( double _Complex ); 4545 long double _Complex asin( long double _Complex ); 4546 4547 float acos( float );§\indexc{acos}§ 4548 double acos( double ); 4549 long double acos( long double ); 4550 float _Complex acos( float _Complex ); 4551 double _Complex acos( double _Complex ); 4552 long double _Complex acos( long double _Complex ); 4553 4554 float atan( float );§\indexc{atan}§ 4555 double atan( double ); 4556 long double atan( long double ); 4557 float _Complex atan( float _Complex ); 4558 double _Complex atan( double _Complex ); 4559 long double _Complex atan( long double _Complex ); 4560 4561 float atan2( float, float );§\indexc{atan2}§ 4562 double atan2( double, double ); 4563 long double atan2( long double, long double ); 4564 4565 float atan( float, float ); // alternative name for atan2 4566 double atan( double, double );§\indexc{atan}§ 4567 long double atan( long double, long double ); 4568 \end{lstlisting} 4569 4570 4571 \subsection{Hyperbolic} 4572 4573 \begin{lstlisting} 4574 float sinh( float );§\indexc{sinh}§ 4575 double sinh( double ); 4576 long double sinh( long double ); 4577 float _Complex sinh( float _Complex ); 4578 double _Complex sinh( double _Complex ); 4579 long double _Complex sinh( long double _Complex ); 4580 4581 float cosh( float );§\indexc{cosh}§ 4582 double cosh( double ); 4583 long double cosh( long double ); 4584 float _Complex cosh( float _Complex ); 4585 double _Complex cosh( double _Complex ); 4586 long double _Complex cosh( long double _Complex ); 4587 4588 float tanh( float );§\indexc{tanh}§ 4589 double tanh( double ); 4590 long double tanh( long double ); 4591 float _Complex tanh( float _Complex ); 4592 double _Complex tanh( double _Complex ); 4593 long double _Complex tanh( long double _Complex ); 4594 4595 float asinh( float );§\indexc{asinh}§ 4596 double asinh( double ); 4597 long double asinh( long double ); 4598 float _Complex asinh( float _Complex ); 4599 double _Complex asinh( double _Complex ); 4600 long double _Complex asinh( long double _Complex ); 4601 4602 float acosh( float );§\indexc{acosh}§ 4603 double acosh( double ); 4604 long double acosh( long double ); 4605 float _Complex acosh( float _Complex ); 4606 double _Complex acosh( double _Complex ); 4607 long double _Complex acosh( long double _Complex ); 4608 4609 float atanh( float );§\indexc{atanh}§ 4610 double atanh( double ); 4611 long double atanh( long double ); 4612 float _Complex atanh( float _Complex ); 4613 double _Complex atanh( double _Complex ); 4614 long double _Complex atanh( long double _Complex ); 4615 \end{lstlisting} 4616 4617 4618 \subsection{Error / Gamma} 4619 4620 \begin{lstlisting} 4621 float erf( float );§\indexc{erf}§ 4622 double erf( double ); 4623 long double erf( long double ); 4624 float _Complex erf( float _Complex ); 4625 double _Complex erf( double _Complex ); 4626 long double _Complex erf( long double _Complex ); 4627 4628 float erfc( float );§\indexc{erfc}§ 4629 double erfc( double ); 4630 long double erfc( long double ); 4631 float _Complex erfc( float _Complex ); 4632 double _Complex erfc( double _Complex ); 4633 long double _Complex erfc( long double _Complex ); 4634 4635 float lgamma( float );§\indexc{lgamma}§ 4636 double lgamma( double ); 4637 long double lgamma( long double ); 4638 float lgamma( float, int * ); 4639 double lgamma( double, int * ); 4640 long double lgamma( long double, int * ); 4641 4642 float tgamma( float );§\indexc{tgamma}§ 4643 double tgamma( double ); 4644 long double tgamma( long double ); 4645 \end{lstlisting} 4646 4647 4648 \subsection{Nearest Integer} 4649 4650 \begin{lstlisting} 4651 float floor( float );§\indexc{floor}§ 4652 double floor( double ); 4653 long double floor( long double ); 4654 4655 float ceil( float );§\indexc{ceil}§ 4656 double ceil( double ); 4657 long double ceil( long double ); 4658 4659 float trunc( float );§\indexc{trunc}§ 4660 double trunc( double ); 4661 long double trunc( long double ); 4662 4663 float rint( float );§\indexc{rint}§ 4664 long double rint( long double ); 4665 long int rint( float ); 4666 long int rint( double ); 4667 long int rint( long double ); 4668 long long int rint( float ); 4669 long long int rint( double ); 4670 long long int rint( long double ); 4671 4672 long int lrint( float );§\indexc{lrint}§ 4673 long int lrint( double ); 4674 long int lrint( long double ); 4675 long long int llrint( float ); 4676 long long int llrint( double ); 4677 long long int llrint( long double ); 4678 4679 float nearbyint( float );§\indexc{nearbyint}§ 4680 double nearbyint( double ); 4681 long double nearbyint( long double ); 4682 4683 float round( float );§\indexc{round}§ 4684 long double round( long double ); 4685 long int round( float ); 4686 long int round( double ); 4687 long int round( long double ); 4688 long long int round( float ); 4689 long long int round( double ); 4690 long long int round( long double ); 4691 4692 long int lround( float );§\indexc{lround}§ 4693 long int lround( double ); 4694 long int lround( long double ); 4695 long long int llround( float ); 4696 long long int llround( double ); 4697 long long int llround( long double ); 4698 \end{lstlisting} 4699 4700 4701 \subsection{Manipulation} 4702 4703 \begin{lstlisting} 4704 float copysign( float, float );§\indexc{copysign}§ 4705 double copysign( double, double ); 4706 long double copysign( long double, long double ); 4707 4708 float frexp( float, int * );§\indexc{frexp}§ 4709 double frexp( double, int * ); 4710 long double frexp( long double, int * ); 4711 4712 float ldexp( float, int );§\indexc{ldexp}§ 4713 double ldexp( double, int ); 4714 long double ldexp( long double, int ); 4715 4716 [ float, float ] modf( float );§\indexc{modf}§ 4717 float modf( float, float * ); 4718 [ double, double ] modf( double ); 4719 double modf( double, double * ); 4720 [ long double, long double ] modf( long double ); 4721 long double modf( long double, long double * ); 4722 4723 float nextafter( float, float );§\indexc{nextafter}§ 4724 double nextafter( double, double ); 4725 long double nextafter( long double, long double ); 4726 4727 float nexttoward( float, long double );§\indexc{nexttoward}§ 4728 double nexttoward( double, long double ); 4729 long double nexttoward( long double, long double ); 4730 4731 float scalbn( float, int );§\indexc{scalbn}§ 4732 double scalbn( double, int ); 4733 long double scalbn( long double, int ); 4734 4735 float scalbln( float, long int );§\indexc{scalbln}§ 4736 double scalbln( double, long int ); 4737 long double scalbln( long double, long int ); 4455 4738 \end{lstlisting} 4456 4739 … … 4464 4747 \begin{lstlisting} 4465 4748 // implementation 4466 struct Rational { 4749 struct Rational {§\indexc{Rational}§ 4467 4750 long int numerator, denominator; // invariant: denominator > 0 4468 4751 }; // Rational
Note: See TracChangeset
for help on using the changeset viewer.