Changes in / [39c4dac:550e819]
- Files:
-
- 1 deleted
- 6 edited
-
doc/bibliography/pl.bib (modified) (1 diff)
-
doc/papers/general/Paper.tex (modified) (39 diffs)
-
tests/coroutine/fibonacci.c (modified) (2 diffs)
-
tests/coroutine/fibonacci_1.c (deleted)
-
tests/coroutine/pingpong.c (modified) (2 diffs)
-
tests/coroutine/prodcons.c (modified) (2 diffs)
-
tests/gmp.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r39c4dac r550e819 929 929 title = {\textsf{C}$\mathbf{\forall}$ Stack Evaluation Programs}, 930 930 year = 2018, 931 howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{ https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},931 howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{\textcolor{blue}{Q4: https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}}}, 932 932 optnote = {[Accessed May 2018]}, 933 933 } -
doc/papers/general/Paper.tex
r39c4dac r550e819 196 196 \author[1]{Robert Schluntz} 197 197 \author[1]{Peter A. Buhr} 198 \author[]{\textcolor{blue}{Q1 AUTHOR NAMES CORRECT}} 198 199 \authormark{MOSS \textsc{et al}} 199 200 … … 207 208 The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from hobby projects to commercial operating systems. 208 209 This installation base and the programmers producing it represent a massive software engineering investment spanning decades and likely to continue for decades more. 209 Nevertheless, C, which was first standardized almost 30 years ago, lacks many features that make programming in more modern languages safer and more productive.210 Nevertheless, C, which was first standardized almost 30 \textcolor{blue}{CHANGE ``40'' TO ``30''} years ago, lacks many features that make programming in more modern languages safer and more productive. 210 211 The goal of the \CFA project (pronounced ``C for all'') is to create an extension of C that provides modern safety and productivity features while still ensuring strong backward compatibility with C and its programmers. 211 212 Prior projects have attempted similar goals but failed to honor the C programming style; … … 225 226 226 227 227 \vspace*{-10pt}228 228 \section{Introduction} 229 229 230 230 The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from hobby projects to commercial operating systems. 231 231 This installation base and the programmers producing it represent a massive software engineering investment spanning decades and likely to continue for decades more. 232 The TIOBE index~\cite{TIOBE} ranks the top five most \emph{popular} programming languages as Java 15\%, \Textbf{C 12\%}, \Textbf{\CC 5.5\%}, and Python 5\%, \Csharp 4.5\% = 42\%, where the next 50 languages are less than 4\% each with a long tail.232 The TIOBE index~\cite{TIOBE} \textcolor{blue}{CHANGE ``TIOBE'' TO ``The TIOBE index''} ranks the top five most \emph{popular} programming languages as Java 15\%, \Textbf{C 12\%}, \Textbf{\CC 5.5\%}, and Python 5\%, \Csharp 4.5\% = 42\%, where the next 50 languages are less than 4\% each with a long tail. 233 233 The top three rankings over the past 30 years are as follows. 234 \newpage 235 \textcolor{blue}{MOVE TABLE HERE} 234 236 \begin{center} 235 237 \setlength{\tabcolsep}{10pt} … … 244 246 \lstMakeShortInline@% 245 247 \end{center} 248 246 249 Love it or hate it, C is extremely popular, highly used, and one of the few systems languages. 247 250 In many cases, \CC is often used solely as a better C. 248 Nevertheless, C, which was first standardized almost 30 years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive.251 Nevertheless, C, which was first standardized almost 30 \textcolor{blue}{CHANGE ``40'' TO ``30''} years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive. 249 252 250 253 \CFA (pronounced ``C for all'' and written \CFA or Cforall) is an evolutionary extension of the C programming language that adds modern language features to C, while maintaining source and runtime compatibility in the familiar C programming model. … … 278 281 ultimately, a compiler is necessary for advanced features and optimal performance. 279 282 % The translator design is based on the \emph{visitor pattern}, allowing multiple passes over the abstract code-tree, which works well for incrementally adding new feature through additional visitor passes. 280 Two key translator components are expression analysis, determining expression validity and what operations are required for its implementation, and code generation, dealing with multiple forms of overloading, polymorphism, and multiple return values by converting them into theC code for a C compiler that supports none of these features.283 Two key translator components are expression analysis, determining expression validity and what operations are required for its implementation, and code generation, dealing with multiple forms of overloading, polymorphism, and multiple return values by converting them into C code for a C compiler that supports none of these features. 281 284 Details of these components are available in chapters 2 and 3 in the work of Bilson~\cite{Bilson03} and form the base for the current \CFA translator. 282 285 % @plg2[8]% cd cfa-cc/src; cloc libcfa … … 342 345 Section~\ref{sec:libraries} includes a number of examples of how this overloading simplifies \CFA programming relative to C. 343 346 Code generation for these overloaded functions and variables is implemented by the usual approach of mangling the identifier names to include a representation of their type, while \CFA decides which overload to apply based on the same ``usual arithmetic conversions'' used in C to disambiguate operator overloads. 344 347 \textcolor{blue}{REMOVE ``We have the following as an example''} 345 348 \newpage 349 \textcolor{blue}{UPDATE FOLLOWING PROGRAM EXAMPLE WITH ADJUSTED COMMENTS TO FIT PAGE WIDTH.} 346 350 \begin{cfa} 347 351 int max = 2147483647; $\C[4in]{// (1)}$ … … 358 362 In some cases, hundreds of names can be reduced to tens, resulting in a significant cognitive reduction. 359 363 In the above, the name @max@ has a consistent meaning, and a programmer only needs to remember the single concept: maximum. 360 To prevent significant ambiguities, \CFA uses the return type in selecting overloads, \eg in the assignment to @m@, the compiler use s@m@'s type to unambiguously select the most appropriate call to function @max@ (as does Ada).364 To prevent significant ambiguities, \CFA uses the return type in selecting overloads, \eg in the assignment to @m@, the compiler use @m@'s type to unambiguously select the most appropriate call to function @max@ (as does Ada). 361 365 As is shown later, there are a number of situations where \CFA takes advantage of available type information to disambiguate, where other programming languages generate ambiguities. 362 366 … … 376 380 \label{sec:poly-fns} 377 381 378 The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a @forall@ clause (giving the language its name). 382 The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a @forall@ clause (giving the language its name). \textcolor{blue}{REMOVE ``as follows''} 379 383 \begin{cfa} 380 384 `forall( otype T )` T identity( T val ) { return val; } … … 391 395 392 396 Since bare polymorphic types provide a restricted set of available operations, \CFA provides a \newterm{type assertion}~\cite[pp.~37-44]{Alphard} mechanism to provide further type information, where type assertions may be variable or function declarations that depend on a polymorphic type variable. 393 For example, the function @twice@ can be defined using the \CFA syntax for operator overloading. 397 For example, the function @twice@ can be defined using the \CFA syntax for operator overloading. \textcolor{blue}{REMOVE ``as follows''} 394 398 \begin{cfa} 395 399 forall( otype T `| { T ?+?(T, T); }` ) T twice( T x ) { return x `+` x; } $\C{// ? denotes operands}$ … … 405 409 Crucial to the design of a new programming language are the libraries to access thousands of external software features. 406 410 Like \CC, \CFA inherits a massive compatible library base, where other programming languages must rewrite or provide fragile interlanguage communication with C. 407 A simple example is leveraging the existing type-unsafe (@void *@) C @bsearch@ to binary search a sorted float array. 411 A simple example is leveraging the existing type-unsafe (@void *@) C @bsearch@ to binary search a sorted float array. \textcolor{blue}{REMOVE ``as follows''} 408 412 \begin{cfa} 409 413 void * bsearch( const void * key, const void * base, size_t nmemb, size_t size, … … 601 605 To enable interoperation among equivalent instantiations of a generic type, the translator saves the set of instantiations currently in scope and reuses the generated structure declarations where appropriate. 602 606 A function declaration that accepts or returns a concrete generic type produces a declaration for the instantiated structure in the same scope, which all callers may reuse. 603 For example, the concrete instantiation for @pair( const char *, int )@ is 607 For example, the concrete instantiation for @pair( const char *, int )@ is \textcolor{blue}{REMOVE ``as follows.''} 604 608 \begin{cfa} 605 609 struct _pair_conc0 { … … 630 634 If a dynamic generic type is declared to be passed or returned by value from a polymorphic function, the translator can safely assume that the generic type is complete (\ie has a known layout) at any call site, and the offset array is passed from the caller; 631 635 if the generic type is concrete at the call site, the elements of this offset array can even be statically generated using the C @offsetof@ macro. 632 As an example, the body of the second @value@ function is implemented as 636 As an example, the body of the second @value@ function is implemented as \textcolor{blue}{REMOVE ``follows.''} 633 637 \begin{cfa} 634 638 _assign_T( _retval, p + _offsetof_pair[1] ); $\C{// return *p.second}$ … … 636 640 \newpage 637 641 \noindent 638 Here, @_assign_T@ is passed in as an implicit parameter from @otype T@, and takes two @T *@ (@void *@ in the generated code), a destination and a source, and @_retval@ is the pointer to a caller-allocated buffer for the return value, the usual \CFA method to handle dynamically sized return types.642 \textcolor{blue}{NO PARAGRAPH INDENT} Here, @_assign_T@ is passed in as an implicit parameter from @otype T@, and takes two @T *@ (@void *@ in the generated code), a destination and a source, and @_retval@ is the pointer to a caller-allocated buffer for the return value, the usual \CFA method to handle dynamically sized return types. 639 643 @_offsetof_pair@ is the offset array passed into @value@; 640 this array is generated at the call site as 644 this array is generated at the call site as \textcolor{blue}{REMOVE ``follows.''} 641 645 \begin{cfa} 642 646 size_t _offsetof_pair[] = { offsetof( _pair_conc0, first ), offsetof( _pair_conc0, second ) } … … 673 677 674 678 Another useful pattern enabled by reused dtype-static type instantiations is zero-cost \newterm{tag structures}. 675 Sometimes, information is only used for type checking and can be omitted at runtime. 679 Sometimes, information is only used for type checking and can be omitted at runtime. \textcolor{blue}{REMOVE ``As an example, we have the following''} 676 680 \begin{cquote} 677 681 \lstDeleteShortInline@% … … 720 724 Both approaches are awkward. 721 725 % FIX 722 Alternatively, a programming language can directly support returning multiple values, \eg \CFA provides the following. 726 Alternatively, a programming language can directly support returning multiple values, \eg \CFA provides the following. \textcolor{blue}{REPLACE ``in \CFA, we have the following'' WITH ``\CFA provides the following''} 723 727 \begin{cfa} 724 728 [ int, int ] div( int num, int den ); $\C{// return two integers}$ … … 741 745 As such, \CFA allows assigning multiple values from a function into multiple variables, using a square-bracketed list of lvalue expressions (as above), called a \newterm{tuple}. 742 746 743 However, functions also use \newterm{composition} (nested calls), with the direct consequence that MRVFs must also support composition to be orthogonal with single-returning-value functions (SRVFs), \eg, \CFA provides the following. 747 However, functions also use \newterm{composition} (nested calls), with the direct consequence that MRVFs must also support composition to be orthogonal with single-returning-value functions (SRVFs), \eg, \CFA provides the following. \textcolor{blue}{REPLACE ``As an example, we have the following'' WITH ``\CFA provides the following''} 744 748 \begin{cfa} 745 749 printf( "%d %d\n", div( 13, 5 ) ); $\C{// return values seperated into arguments}$ … … 777 781 printf( "%d %d\n", qr ); 778 782 \end{cfa} 779 \CFA also supports \newterm{tuple indexing} to access single components of a tuple expression. 783 \CFA also supports \newterm{tuple indexing} to access single components of a tuple expression. \textcolor{blue}{REMOVE ``as follows''} 780 784 \begin{cfa} 781 785 [int, int] * p = &qr; $\C{// tuple pointer}$ … … 805 809 In the call to @f@, @x@ is implicitly flattened so the components of @x@ are passed as two arguments. 806 810 In the call to @g@, the values @y@ and @10@ are structured into a single argument of type @[int, int]@ to match the parameter type of @g@. 807 Finally, in the call to @h@, @x@ is flattened to yield an argument list of length 3, of which the first component of @x@ is passed as the first parameter of @h@, and the second component of @x@ and @y@ are structured into the second argument of type @[int, int]@.808 The flexible structure of tuples permits a simple and expressive function call syntax to work seamlessly with both SRVFs and MRVFs with any number of arguments of arbitrarily complex structure.811 Finally, in the call to @h@, @x@ is flattened to yield an argument list of length 3, of which the first component of @x@ is passed as the first parameter of @h@, and the second component \textcolor{blue}{CHANGE ``components'' TO ``component''} of @x@ and @y@ are structured into the second argument of type @[int, int]@. 812 The flexible structure of tuples permits a simple and expressive function call syntax to work seamlessly with both SRVFs and MRVFs \textcolor{blue}{REMOVE ``and''} with any number of arguments of arbitrarily complex structure. 809 813 810 814 811 815 \subsection{Tuple assignment} 812 816 813 \enlargethispage{-10pt}814 817 An assignment where the left side is a tuple type is called \newterm{tuple assignment}. 815 818 There are two kinds of tuple assignment depending on whether the right side of the assignment operator has a tuple type or a nontuple type, called \newterm{multiple} and \newterm{mass assignment}, respectively. … … 825 828 Both kinds of tuple assignment have parallel semantics, so that each value on the left and right sides is evaluated before any assignments occur. 826 829 As a result, it is possible to swap the values in two variables without explicitly creating any temporary variables or calling a function, \eg, @[x, y] = [y, x]@. 827 This semantics means mass assignment differs from C cascading assignment (\eg @a = b = c@) in that conversions are applied in each individual assignment, which prevents data loss from the chain of conversions that can happen during a cascading assignment. 830 This semantics means mass assignment differs from C cascading 831 \newpage 832 assignment (\eg @a = b = c@) in that conversions are applied in each individual assignment, which prevents data loss from the chain of conversions that can happen during a cascading assignment. 828 833 For example, @[y, x] = 3.14@ performs the assignments @y = 3.14@ and @x = 3.14@, yielding @y == 3.14@ and @x == 3@, whereas C cascading assignment @y = x = 3.14@ performs the assignments @x = 3.14@ and @y = x@, yielding @3@ in @y@ and @x@. 829 834 Finally, tuple assignment is an expression where the result type is the type of the left-hand side of the assignment, just like all other assignment expressions in C. … … 852 857 [int, int, int] y = x.[2, 0, 2]; $\C{// duplicate: [y.0, y.1, y.2] = [x.2, x.0.x.2]}$ 853 858 \end{cfa} 854 It is also possible for a member access to contain other member accesses. 859 It is also possible for a member access to contain other member accesses. \textcolor{blue}{REMOVE ``, as follows.''} 855 860 \begin{cfa} 856 861 struct A { double i; int j; }; … … 964 969 Since nothing is known about a parameter pack by default, assertion parameters are key to doing anything meaningful. 965 970 Unlike variadic templates, @ttype@ polymorphic functions can be separately compiled. 966 For example, the following is a generalized @sum@ function.971 For example, the following is a \textcolor{blue}{CHANGE ``As an example, we have the following'' TO ``For example, the following is a''} generalized @sum@ function. 967 972 \begin{cfa} 968 973 int sum$\(_0\)$() { return 0; } … … 998 1003 Unlike C variadic functions, it is unnecessary to hard code the number and expected types. 999 1004 Furthermore, this code is extendable for any user-defined type with a @?+?@ operator. 1000 Summing arbitrary heterogeneous lists is possible with similar code by adding the appropriate type variables and addition operators.1005 Summing \textcolor{blue}{REMOVE ``up''} arbitrary heterogeneous lists is possible with similar code by adding the appropriate type variables and addition operators. 1001 1006 1002 1007 It is also possible to write a type-safe variadic print function to replace @printf@: … … 1034 1039 Tuples are implemented in the \CFA translator via a transformation into \newterm{generic types}. 1035 1040 For each $N$, the first time an $N$-tuple is seen in a scope, a generic type with $N$ type parameters is generated. 1036 For example, the following 1041 For example, the following \textcolor{blue}{CHANGE ``, as follows:'' TO ``For example, the following''} 1037 1042 \begin{cfa} 1038 1043 [int, int] f() { … … 1514 1519 \end{cfa} 1515 1520 1516 Finally, \CFA provides a Java-like @finally@ clause after the catch clauses.1521 \textcolor{blue}{PARAGRAPH INDENT} Finally, \CFA provides a Java-like @finally@ clause after the catch clauses. 1517 1522 \begin{cfa} 1518 1523 try { … … 1650 1655 1651 1656 C declaration syntax is notoriously confusing and error prone. 1652 For example, many C programmers are confused by a declaration as simple as the following. 1657 For example, many C programmers are confused by a declaration as simple as the following. \textcolor{blue}{CHANGE ``simple a declaration as in'' TO ``declaration as simple as''} 1653 1658 \begin{cquote} 1654 1659 \lstDeleteShortInline@% … … 1704 1709 % Specifically, the character @*@ is used to indicate a pointer, square brackets @[@\,@]@ are used to represent an array or function return value, and parentheses @()@ are used to indicate a function parameter. 1705 1710 However, unlike C, \CFA type declaration tokens are distributed across all variables in the declaration list. 1706 For instance, variables @x@ and @y@ of type pointer to integer are defined in \CFA as 1711 For instance, variables @x@ and @y@ of type pointer to integer are defined in \CFA as \textcolor{blue}{REMOVE ``follows.''} 1707 1712 \begin{cquote} 1708 1713 \lstDeleteShortInline@% … … 1954 1959 Since \CFA in not object oriented, adopting dynamic scoping does not make sense; 1955 1960 instead, \CFA adopts \CC static nesting, using the member-selection operator ``@.@'' for type qualification, as does Java, rather than the \CC type-selection operator ``@::@'' (see Figure~\ref{f:TypeNestingQualification}). 1956 In the C left example, types @C@, @U@ and @T@ are implicitly hoisted outside of type @S@ into the containing block scope.1957 In the \CFA right example, the types are not hoisted and accessible.1958 1961 1959 1962 \begin{figure} … … 2025 2028 \vspace*{-8pt} 2026 2029 \end{figure} 2030 2031 In the C left example, types @C@, @U@ and @T@ are implicitly hoisted outside of type @S@ into the containing block scope. 2032 In the \CFA right example, the types are not hoisted and accessible. 2027 2033 2028 2034 … … 2060 2066 For details of the code-generation placement of implicit constructor and destructor calls among complex executable statements, see section~2.2 in the work of Schlintz~\cite{Schluntz17}. 2061 2067 2062 \CFA also provides syntax for \newterm{initialization} and \newterm{copy}. 2068 \CFA also provides syntax for \newterm{initialization} and \newterm{copy}. \textcolor{blue}{REMOVE ``, as follows''} 2063 2069 \begin{cfa} 2064 2070 void ?{}( VLA & vla, int size, char fill = '\0' ) { $\C{// initialization}$ … … 2125 2131 2126 2132 A simple example is allowing the underscore, as in Ada, to separate prefixes, digits, and suffixes in all \CFA constants, \eg @0x`_`1.ffff`_`ffff`_`p`_`128`_`l@, where the underscore is also the standard separator in C identifiers. 2127 \CC uses a single quote as a separator, but it is restricted among digits, precluding its use in the literal prefix or suffix, \eg @0x1.ffff@@`'@@ffffp128l@, and causes problems with most integrated development environments (IDEs), which must be extended to deal with this alternate use of the single quote.2133 \CC uses a single quote as a separator, but it is restricted among digits, precluding its use in the literal prefix or suffix, \eg @0x1.ffff@@`'@@ffffp128l@, and causes problems with most \textcolor{blue}{Q2 CHANGE ``IDEs'' TO ``integrated development environments (IDEs)''}, which must be extended to deal with this alternate use of the single quote. 2128 2134 2129 2135 … … 2197 2203 y = "12345678901234567890123456789"|`mp| + "12345678901234567890123456789"|`mp|; 2198 2204 \end{cfa} 2199 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.2205 Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions, where @?`@ \textcolor{blue}{USE CHARACTER \lstinline@`@ NOT \textsf{'}} denotes a postfix-function name and @`@ \textcolor{blue}{USE CHARACTER \lstinline@`@ NOT `} denotes a postfix-function call. 2200 2206 }% 2201 2207 \begin{cquote} … … 2339 2345 \lstMakeShortInline@% 2340 2346 \end{cquote} 2341 The result is a significant reduction in names to access typed constants. 2347 The result is a significant reduction in names to access typed constants. \textcolor{blue}{REMOVE ``, as follows.''} 2342 2348 \begin{cquote} 2343 2349 \lstDeleteShortInline@% … … 2384 2390 \lstMakeShortInline@% 2385 2391 \end{cquote} 2386 The result is a significant reduction in names to access math functions. 2392 The result is a significant reduction in names to access math functions. \textcolor{blue}{REMOVE ``, as follows.''} 2387 2393 \begin{cquote} 2388 2394 \lstDeleteShortInline@% … … 2431 2437 \lstMakeShortInline@% 2432 2438 \end{cquote} 2433 The result is a significant reduction in names to access the utility functions. 2439 The result is a significant reduction in names to access the utility functions. \textcolor{blue}{REMOVE ``, as follows.''} 2434 2440 \begin{cquote} 2435 2441 \lstDeleteShortInline@% … … 2452 2458 In addition, there are polymorphic functions, like @min@ and @max@, that work on any type with operator @?<?@ or @?>?@. 2453 2459 2454 The following shows one example where \CFA \ emph{extends} an existing standard C interface to reduce complexity and provide safety.2460 The following shows one example where \CFA \textcolor{blue}{ADD SPACE} \emph{extends} an existing standard C interface to reduce complexity and provide safety. 2455 2461 C/\Celeven provide a number of complex and overlapping storage-management operations to support the following capabilities. 2456 2462 \begin{list}{}{\itemsep=0pt\parsep=0pt\labelwidth=0pt\leftmargin\parindent\itemindent-\leftmargin\let\makelabel\descriptionlabel} … … 2643 2649 \label{s:MultiPrecisionIntegers} 2644 2650 2645 \CFA has an interface to the GNU multiple precision (GMP)signed integers~\cite{GMP}, similar to the \CC interface provided by GMP.2651 \CFA has an interface to the \textcolor{blue}{Q3 CHANGE ``GMP multiprecision'' TO ``GNU multiple precision (GMP)''} signed integers~\cite{GMP}, similar to the \CC interface provided by GMP. 2646 2652 The \CFA interface wraps GMP functions into operator functions to make programming with multiprecision integers identical to using fixed-sized integers. 2647 2653 The \CFA type name for multiprecision signed integers is @Int@ and the header file is @gmp@. … … 2736 2742 Figure~\ref{fig:eval} and Table~\ref{tab:eval} show the results of running the benchmark in Figure~\ref{fig:BenchmarkTest} and its C, \CC, and \CCV equivalents. 2737 2743 The graph plots the median of five consecutive runs of each program, with an initial warm-up run omitted. 2738 All code is compiled at \texttt{-O2} by gcc or g++ 6.4.0, with all \CC code compiled as \CCfourteen. 2739 The benchmarks are run on an Ubuntu 16.04 workstation with 16 GB of RAM and a 6-core AMD FX-6300 CPU with 3.5 GHz maximum clock frequency.2744 All code is compiled at \texttt{-O2} by gcc or g++ 6.4.0, with all \CC code compiled as \CCfourteen. \textcolor{blue}{CHANGE ``\CC{}fourteen'' TO ``\CCfourteen''} 2745 The benchmarks are run on an Ubuntu 16.04 workstation with 16 GB of RAM and a 6-core AMD FX-6300 CPU with 3.5 GHz \textcolor{blue}{REMOVE ``of''} maximum clock frequency. 2740 2746 2741 2747 \begin{figure} … … 2764 2770 \end{table} 2765 2771 2766 \enlargethispage{-10pt}2767 2772 The C and \CCV variants are generally the slowest with the largest memory footprint, due to their less-efficient memory layout and the pointer indirection necessary to implement generic types; 2768 2773 this inefficiency is exacerbated by the second level of generic types in the pair benchmarks. … … 2855 2860 Tuples are a generalization of @std::pair@, in that they allow for arbitrary length, fixed-size aggregation of heterogeneous values. 2856 2861 Operations include @std::get<N>@ to extract values, @std::tie@ to create a tuple of references used for assignment, and lexicographic comparisons. 2857 \CCseventeen proposes \emph{structured bindings}~\cite{Sutter15} to eliminate predeclaring variables and the use of @std::tie@ for binding the results.2862 \CCseventeen \textcolor{blue}{CHANGE ``\CC{}seventeen TO ``\CCseventeen''} proposes \emph{structured bindings}~\cite{Sutter15} to eliminate predeclaring variables and the use of @std::tie@ for binding the results. 2858 2863 This extension requires the use of @auto@ to infer the types of the new variables; hence, complicated expressions with a nonobvious type must be documented with some other mechanism. 2859 2864 Furthermore, structured bindings are not a full replacement for @std::tie@, as it always declares new variables. -
tests/coroutine/fibonacci.c
r39c4dac r550e819 6 6 // 7 7 // fibonacci.c -- 3-state finite-state machine 8 8 9 // 9 10 // Author : Thierry Delisle 10 11 // Created On : Thu Jun 8 07:29:37 2017 11 12 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 11:21:58201813 // Update Count : 2 413 // Last Modified On : Thu Aug 16 08:18:16 2018 14 // Update Count : 20 14 15 // 15 16 … … 38 39 int main() { 39 40 Fibonacci f1, f2; 40 for ( 10 ) { // print N Fibonacci values41 for ( int i = 1; i <= 10; i += 1 ) { 41 42 sout | next( f1 ) | next( f2 ) | endl; 42 43 } // for -
tests/coroutine/pingpong.c
r39c4dac r550e819 10 10 // Created On : Wed Sep 20 11:55:23 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 11:31:11 201813 // Update Count : 2 812 // Last Modified On : Wed Sep 20 13:41:39 2017 13 // Update Count : 26 14 14 // 15 15 … … 39 39 } 40 40 void main( PingPong & pingpong ) { // ping's starter ::main, pong's starter ping 41 for ( pingpong.N ) { // N ping-pongs41 for ( unsigned int i = 0; i < pingpong.N; i += 1 ) { 42 42 sout | pingpong.name | endl; 43 43 cycle( *pingpong.part ); -
tests/coroutine/prodcons.c
r39c4dac r550e819 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 12:55:10201813 // Update Count : 5112 // Last Modified On : Tue Jan 2 12:17:01 2018 13 // Update Count : 47 14 14 // 15 15 16 16 #include <fstream.hfa> 17 17 #include <coroutine.hfa> 18 #include <stdlib.hfa> // random18 #include <stdlib.hfa> // random 19 19 #include <unistd.h> // getpid 20 20 … … 29 29 void main( Prod & prod ) with( prod ) { // starter ::main 30 30 // 1st resume starts here 31 for ( i ; N ) { // N pairs of values31 for ( int i = 0; i < N; i += 1 ) { 32 32 int p1 = random( 100 ); 33 33 int p2 = random( 100 ); -
tests/gmp.c
r39c4dac r550e819 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 12:43:13 201813 // Update Count : 55 612 // Last Modified On : Thu Sep 28 18:33:51 2017 13 // Update Count : 555 14 14 // 15 15 … … 89 89 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 90 90 sout | 1 | fn | endl; 91 for ( i; 2u ~= 200) {91 for ( unsigned int i = 2; i <= 200; i += 1 ) { 92 92 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 93 93 sout | i | fn | endl; … … 99 99 Int fact = 1; // 1st case 100 100 sout | (int)0 | fact | endl; 101 for ( i; 1u ~= 40u) {101 for ( unsigned int i = 1; i <= 40; i += 1 ) { 102 102 fact *= i; // general case 103 103 sout | i | fact | endl;
Note:
See TracChangeset
for help on using the changeset viewer.