Changeset 41624f92 for doc


Ignore:
Timestamp:
Mar 22, 2018, 4:22:06 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
dc7db63
Parents:
f810e09
Message:

tuple functions missing tuple-return syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/Paper.tex

    rf810e09 r41624f92  
    671671\begin{cfa}
    672672int f( int, int );
    673 int g( [int, int] );
    674 int h( int, [int, int] );
     673[int] g( [int, int] );
     674[int] h( int, [int, int] );
    675675[int, int] x;
    676676int y;
     
    706706This example shows mass, multiple, and cascading assignment used in one expression:
    707707\begin{cfa}
    708 void f( [int, int] );
     708[void] f( [int, int] );
    709709f( [x, y] = z = 1.5 );                                          $\C{// assignments in parameter list}$
    710710\end{cfa}
     
    814814Flattening and restructuring conversions are also applied to tuple types in polymorphic type assertions.
    815815\begin{cfa}
    816 int f( [int, double], double );
     816[int] f( [int, double], double );
    817817forall( otype T, otype U | { T f( T, U, U ); } ) void g( T, U );
    818818g( 5, 10.21 );
     
    11521152  case 4:
    11531153        ... `fallthrough common;`
    1154   common: // below fallthrough at same level as case clauses
     1154  `common`: // below fallthrough at same level as case clauses
    11551155        ...      // common code for cases 3 and 4
    11561156        // implicit break
     
    18571857\begin{cfa}
    18581858struct S { double x, y; };
    1859 int i, j;
     1859int x, y;
    18601860void f( int & i, int & j, S & s, int v[] );
    1861 f( 3, i + j, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } );   $\C{// pass rvalue to lvalue \(\Rightarrow\) implicit temporary}$
     1861f( 3, x + y, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); $\C{// pass rvalue to lvalue \(\Rightarrow\) implicit temporary}$
    18621862\end{cfa}
    18631863This allows complex values to be succinctly and efficiently passed to functions, without the syntactic overhead of explicit definition of a temporary variable or the runtime cost of pass-by-value.
     
    19981998{
    19991999        VLA  x,            y = { 20, 0x01 },     z = y; $\C{// z points to y}$
    2000         //      ?{}( x );  ?{}( y, 20, 0x01 );  ?{}( z, y );
     2000        //    ?{}( x );   ?{}( y, 20, 0x01 );    ?{}( z, y );
    20012001        ^x{};                                                                   $\C{// deallocate x}$
    20022002        x{};                                                                    $\C{// reallocate x}$
Note: See TracChangeset for help on using the changeset viewer.