Changeset 41624f92 for doc/papers/general
- Timestamp:
- Mar 22, 2018, 4:22:06 PM (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:
- dc7db63
- Parents:
- f810e09
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
rf810e09 r41624f92 671 671 \begin{cfa} 672 672 int f( int, int ); 673 intg( [int, int] );674 inth( int, [int, int] );673 [int] g( [int, int] ); 674 [int] h( int, [int, int] ); 675 675 [int, int] x; 676 676 int y; … … 706 706 This example shows mass, multiple, and cascading assignment used in one expression: 707 707 \begin{cfa} 708 voidf( [int, int] );708 [void] f( [int, int] ); 709 709 f( [x, y] = z = 1.5 ); $\C{// assignments in parameter list}$ 710 710 \end{cfa} … … 814 814 Flattening and restructuring conversions are also applied to tuple types in polymorphic type assertions. 815 815 \begin{cfa} 816 intf( [int, double], double );816 [int] f( [int, double], double ); 817 817 forall( otype T, otype U | { T f( T, U, U ); } ) void g( T, U ); 818 818 g( 5, 10.21 ); … … 1152 1152 case 4: 1153 1153 ... `fallthrough common;` 1154 common: // below fallthrough at same level as case clauses1154 `common`: // below fallthrough at same level as case clauses 1155 1155 ... // common code for cases 3 and 4 1156 1156 // implicit break … … 1857 1857 \begin{cfa} 1858 1858 struct S { double x, y; }; 1859 int i, j;1859 int x, y; 1860 1860 void 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}$1861 f( 3, x + y, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); $\C{// pass rvalue to lvalue \(\Rightarrow\) implicit temporary}$ 1862 1862 \end{cfa} 1863 1863 This 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. … … 1998 1998 { 1999 1999 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 ); 2001 2001 ^x{}; $\C{// deallocate x}$ 2002 2002 x{}; $\C{// reallocate x}$
Note: See TracChangeset
for help on using the changeset viewer.