Changeset 84832d87 for doc/papers/general
- Timestamp:
- Mar 23, 2018, 9:26:40 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- 766309d
- Parents:
- aac7197
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
raac7197 r84832d87 1946 1946 1947 1947 One of the strengths (and weaknesses) of C is memory-management control, allowing resource release to be precisely specified versus unknown release with garbage-collected memory-management. 1948 However, this manual approach is oftenverbose, and it is useful to manage resources other than memory (\eg file handles) using the same mechanism as memory.1948 However, this manual approach is verbose, and it is useful to manage resources other than memory (\eg file handles) using the same mechanism as memory. 1949 1949 \CC addresses these issues using Resource Aquisition Is Initialization (RAII), implemented by means of \newterm{constructor} and \newterm{destructor} functions; 1950 1950 \CFA adopts constructors and destructors (and @finally@) to facilitate RAII. … … 2099 2099 2100 2100 For readability, it is useful to associate units to scale literals, \eg weight (stone, pound, kilogram) or time (seconds, minutes, hours). 2101 The left of Figure~\ref{f:UserLiteral} shows the \CFA alternative call-syntax ( literal argument before function name), using the backquote, to convert basic literals into user literals.2101 The left of Figure~\ref{f:UserLiteral} shows the \CFA alternative call-syntax (postfix: literal argument before function name), using the backquote, to convert basic literals into user literals. 2102 2102 The backquote is a small character, making the unit (function name) predominate. 2103 2103 For examples, the multi-precision integer-type in Section~\ref{s:MultiPrecisionIntegers} has user literals: … … 2107 2107 y = "12345678901234567890123456789"|`mp| + "12345678901234567890123456789"|`mp|; 2108 2108 \end{cfa} 2109 Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions .2109 Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions, where @?`@ denotes a postfix-function name and @`@ denotes a postfix-function call. 2110 2110 }% 2111 \begin{cquote} 2112 \lstset{language=CFA,moredelim=**[is][\color{red}]{|}{|},deletedelim=**[is][]{`}{`}} 2113 \lstDeleteShortInline@% 2114 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}} 2115 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{postfix function}} & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{constant}} & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{variable/expression}} & \multicolumn{1}{c}{\textbf{postfix pointer}} \\ 2116 \begin{cfa} 2117 int ?`h( int s ); 2118 int ?`h( double s ); 2119 int ?`m( char c ); 2120 int ?`m( const char * s ); 2121 int ?`t( int a, int b, int c ); 2122 \end{cfa} 2123 & 2124 \begin{cfa} 2125 0 `h; 2126 3.5`h; 2127 '1'`m; 2128 "123" "456"`m; 2129 [1,2,3]`t; 2130 \end{cfa} 2131 & 2132 \begin{cfa} 2133 int i = 7; 2134 i`h; 2135 (i + 3)`h; 2136 (i + 3.5)`h; 2137 2138 \end{cfa} 2139 & 2140 \begin{cfa} 2141 int (* ?`p)( int i ); 2142 ?`p = ?`h; 2143 3`p; 2144 i`p; 2145 (i + 3)`p; 2146 \end{cfa} 2147 \end{tabular} 2148 \lstMakeShortInline@% 2149 \end{cquote} 2111 2150 2112 2151 The right of Figure~\ref{f:UserLiteral} shows the equivalent \CC version using the underscore for the call-syntax.
Note: See TracChangeset
for help on using the changeset viewer.