Changeset 567a75f for doc


Ignore:
Timestamp:
Aug 30, 2025, 9:13:52 AM (4 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
7a8de40
Parents:
304e436
Message:

updates to uC++toCFA.tex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/uC++toCFA/uC++toCFA.tex

    r304e436 r567a75f  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat Mar 15 13:38:53 2025
    14 %% Update Count     : 6302
     13%% Last Modified On : Thu Aug 28 13:41:34 2025
     14%% Update Count     : 6493
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
    17 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
    1817
    1918\documentclass[11pt]{article}
     
    8382\setlength{\topmargin}{-0.45in}                                                 % move running title into header
    8483\setlength{\headsep}{0.25in}
     84\setlength{\tabcolsep}{15pt}
    8585
    8686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    134134
    135135\maketitle
    136 \vspace*{-0.55in}
     136\vspace*{-0.65in}
    137137
    138138\section{Introduction}
     
    141141\CFA uses parametric polymorphism and allows overloading of variables and routines:
    142142\begin{cfa}
    143 int i;  char i;  double i;      $\C[2in]{// overload name i}$
    144 int i();  double i();  char i();
    145 i += 1;                                         $\C{// int i}$
    146 i += 1.0;                                       $\C{// double i}$
    147 i += 'a';                                       $\C{// char i}$
    148 int j = i();                            $\C{// int i()}$
    149 double j = i();                         $\C{// double i();}$
    150 char j = i();                           $\C{// char i()}\CRT$
    151 \end{cfa}
     143int x;  char x;  double x;    // overload name x
     144int x();  double x();  char x();
     145\end{cfa}
     146\vspace*{-8pt}
     147\begin{cquote}
     148\begin{tabular}{@{}l@{\hspace{1in}}|l@{}}
     149\begin{cfa}
     150x += 42;        $\C[1in]{// int x}$
     151x += 42.2;      $\C{// double x}$
     152x += 'a';       $\C{// char x}\CRT$
     153\end{cfa}
     154&
     155\begin{cfa}
     156int j = x();    $\C[1in]{// int x()}$
     157double j = x(); $\C{// double x();}$
     158char j = x();   $\C{// char x()}\CRT$
     159\end{cfa}
     160\end{tabular}
     161\end{cquote}
    152162\CFA has rebindable references.
    153163\begin{cquote}
     
    165175&
    166176\begin{cfa}
    167 r2i = 3; $\C[1.0in]{// change x}$
     177r2i = 3;         $\C[0.875in]{// change x}$
    168178&r2i = &r1y; $\C{// change p2i / r2i}$
    169 r2i = 3; $\C{// change y}$
     179r2i = 3;        $\C{// change y}$
    170180&r1x = &r1y; $\C{// change p1x / r1x}$
    171 r2i = 4; $\C{// change y}$
     181r2i = 4;        $\C{// change y}$
    172182&r1x = @0p@; $\C{// reset}\CRT$
    173183\end{cfa}
     
    194204\end{cfa}
    195205\noindent
    196 In subsequent code examples, the left example is \uC and the right example is \CFA.
    197 
    198 
    199 \section{Looping}
    200 
    201 \begin{cquote}
    202 \begin{tabular}{@{}l|l@{}}
    203 \begin{uC++}
    204 for ( @;;@ ) { ... }  /  while ( @true@ ) { ... }
     206In subsequent code examples, the left example is \CC/\uC and the right example is \CFA.
     207
     208
     209\section{Control Flow}
     210
     211The @choose@ statement provides an implicit @break@ after the @case@ clause for safety.
     212It is possible to @break default@ in a @case@ clause to transfer to common code in the @default@ clause.
     213\begin{cquote}
     214\begin{tabular}{@{}l|l@{}}
     215\begin{uC++}
     216switch ( i ) {
     217  case 1: ... @break@; // explicit break
     218  case 2: ... @break@; // explicit break
     219  default: ... ;
     220}
     221\end{uC++}
     222&
     223\begin{cfa}
     224choose ( i ) {
     225  case 1: ... ; // implicit break
     226  case 2: ... ; // implicit break
     227  default: ... ;
     228}
     229\end{cfa}
     230\end{tabular}
     231\end{cquote}
     232To simplify creating an infinite loop, the loop condition in optional.
     233\begin{cquote}
     234\begin{tabular}{@{}l|l@{}}
     235\begin{uC++}
     236while ( true ) ...
     237for ( ;; ) ...
     238do ... while ( true )
     239\end{uC++}
     240&
     241\begin{uC++}
     242while ($\,$) ...
     243for ($\,$) ...
     244do ... while ($\,$)
     245\end{uC++}
     246\end{tabular}
     247\end{cquote}
     248To simplify loop iteration a range is provided, specified from low to high, and a traversal direction, ascending (@+@) or descending (@-@).
     249The following is the syntax for the loop range, where @[@\,@]@ means optional.
     250\begin{cfa}[deletekeywords=default]
     251[ @index ;@ ] [ [ @min@ (default 0) ] [ direction @+@/@-@ (default +) ] @~@ [ @=@ (include endpoint) ] ] @max@ [ @~ increment@ ]
     252\end{cfa}
     253For @=@, the range includes the endpoint (@max@/@min@) depending on the direction (@+@/@-@).
     254\begin{cquote}
     255\begin{tabular}{@{}l|l@{}}
     256\begin{uC++}
    205257for ( int i = 0; i < @10@; i += 1 ) { ... }
    206258for ( int i = @5@; i < @15@; i += @2@ ) { ... }
    207 for ( int i = -1; i <@=@ 10; i += 3 ) { ... }
    208 for ( int i = 10; i > 0; i @-@= 1 ) { ... }
    209 \end{uC++}
    210 &
    211 \begin{cfa}
    212 for () { ... }  /  while () { ... }
    213 for ( @10@ ) { ... }  /  for ( i; @10@ ) { ... }
    214 for ( i; @5@ ~ @15@ ~ @2@ ) { ... }
    215 for ( i; -1 ~@=@ 10 ~ 3 ) { ... }
    216 for ( i; 0 @-@~ 10 ) { ... }
    217 \end{cfa}
    218 \end{tabular}
    219 \end{cquote}
    220 
     259for ( int i = -2; i <@=@ 10; i += 3 ) { ... }
     260for ( int i = 10; i > -3; i @-@= 1 ) { ... }
     261for ( int i = 10; i >@=@ 0; i @-@= 1 ) { ... }
     262\end{uC++}
     263&
     264\begin{cfa}
     265for ( @10@ ) { ... }  /  for ( i; @10@ ) { ... }  // 0 to 9 by 1
     266for ( i; @5@ ~ @15@ ~ @2@ ) { ... } // 5 to 14 by 2
     267for ( i; -2 ~@=@ 10 ~ 3 ) { ... } // -2 to 10 by 3
     268for ( i; -3 @-@~ 10 ) { ... } // not 10 -~= -3, 10 to -2 by -1
     269for ( i; 0 @-@~@=@ 10 ) { ... } // not 10 -~= 0, 10 to 0 by -1
     270\end{cfa}
     271\end{tabular}
     272\end{cquote}
     273A terminating loop @else@ (like Python) is executed if the loop terminates normally, \ie the loop conditional becomes false, which is safer than retesting after the loop.
     274The loop index is available in the @else@ clause.
    221275\begin{cquote}
    222276\begin{tabular}{@{}l|l@{}}
     
    230284
    231285for ( i; 10 ) { ... }
    232 @else@ { ... } // i == 10
    233 \end{cfa}
    234 \end{tabular}
    235 \end{cquote}
    236 
    237 \begin{cquote}
    238 \begin{tabular}{@{}l|l@{}}
    239 \begin{uC++}
     286@else@ { ... } // i == 10 because of post increment
     287\end{cfa}
     288\end{tabular}
     289\end{cquote}
     290Single/multiple-level loop exit/continue is provided by the labelled @break@/@continue@. (First example is \CC.)
     291\begin{cquote}
     292\begin{tabular}{@{}l|l|l@{}}
     293\begin{C++}
    240294@L1:@ for ( ;; ) {
    241         @L2:@ for ( ;; ) {
    242                 ... if ( ... ) @break L1@; ...
    243                 ... if ( ... ) @break L2@; ...
    244         }
    245 }
    246 \end{uC++}
     295        for ( ;; ) {
     296                ... if ( ... ) @goto L1@; ...
     297                ... if ( ... ) @goto L2@; ...
     298        } @L2: ;@
     299}
     300\end{C++}
    247301&
    248302\begin{cfa}
    249303@L1:@ for () {
    250304        @L2:@ for () {
    251                 ... if ( ... ) @break L1@; ...
     305                ... if ( ... ) @continue L1@; ...
    252306                ... if ( ... ) @break L2@; ...
    253307        }
    254308}
    255309\end{cfa}
    256 \end{tabular}
    257 \end{cquote}
    258 
    259 
    260 \section{Stream I/O}
    261 
    262 \CFA output streams automatically separate values and insert a newline at the end of the print.
    263 \begin{cquote}
    264 \begin{tabular}{@{}l|l@{}}
    265 \begin{uC++}
    266 #include <@iostream@>
    267 using namespace std;
    268 int i;   double d;   char c;
    269 cin >> i >> d >> c;
    270 cout << i << ' ' << d << ' ' << c << endl;
    271 \end{uC++}
    272 &
    273 \begin{cfa}
    274 #include <@fstream.hfa@>
    275 
    276 int i;   double d;   char c;
    277 sin | i | d | c;
    278 sout | i | d | c
    279 \end{cfa}
    280 \end{tabular}
    281 \end{cquote}
    282 To disable/enable automatic newline at the end of printing, use @nlOff@/@nlOn@ and @nl@.
    283 \begin{cquote}
    284 \begin{tabular}{@{}l|l@{}}
    285 \begin{uC++}
    286 
    287 for ( int i = 0; i < 5; i += 1 ) cout << i << ' ';
    288 cout << @endl@;
    289 
    290 0 1 2 3 4
    291 \end{uC++}
    292 &
    293 \begin{cfa}
    294 sout | @nlOff@; // disable auto nl
    295 for ( i; 5 ) sout | i;
    296 sout | @nl@;
    297 sout | @nlOn@;  // reenable auto nl
    298 0 1 2 3 4
    299 \end{cfa}
    300 \end{tabular}
    301 \end{cquote}
    302 Floating-point numbers without a fraction print with a decimal point, which can be disabled with @nodp@.
    303 \begin{cquote}
    304 \begin{tabular}{@{}l|l@{}}
    305 \begin{uC++}
    306 cout << 3.0 << ' ' << showpoint << setprecision(0) << 3.0 << endl;
    307 3 3.
    308 \end{uC++}
    309 &
    310 \begin{cfa}
    311 sout | @nodp( 3.0 )@ | 3.0;
    312 3 3.
     310&
     311\begin{cfa}
     312@L1:@ for () {
     313        @L2:@ for () {
     314                ... if ( ... ) @continue L1@; ...
     315                ... if ( ... ) @break L2@; ...
     316        }
     317}
    313318\end{cfa}
    314319\end{tabular}
     
    320325Currently, \CFA uses macros @ExceptionDecl@ and @ExceptionInst@ to declare and instantiate an exception.
    321326\begin{cquote}
     327\setlength{\tabcolsep}{5pt}
    322328\begin{tabular}{@{}l|ll@{}}
    323329\begin{uC++}
     
    327333};
    328334try {
    329         ...
    330         if ( ... ) @_Resume@ E( /* initialization */ );
    331         if ( ... ) @_Throw@ E( /* initialization */ );
    332                 ...
     335        ... if ( ... ) @_Resume@ E( /* initialization */ ); ...
     336        ... if ( ... ) @_Throw@ E( /* initialization */ ); ...
    333337} @_CatchResume@( E & /* reference */ ) { ... }
    334338  catch( E & ) { ... }
     
    343347);
    344348try {
    345         ...
    346         if ( ... ) @throwResume@ @ExceptionInst@( E, /* intialization */ );
    347         if ( ... ) @throw@ @ExceptionInst@( E, /* intialization */ );
    348         ...
     349        ... if ( ... ) @throwResume@ @ExceptionInst@( E, /* intialization */ ); ...
     350        ... if ( ... ) @throw@ @ExceptionInst@( E, /* intialization */ ); ...
    349351} @catchResume@( E @*@ /* pointer */ ) { ... }
    350352  catch( E * ) { ... }
     
    389391
    390392
     393\section{Stream I/O}
     394
     395\CFA output streams automatically separate values and insert a newline at the end of the print.
     396\begin{cquote}
     397\begin{tabular}{@{}l|l@{}}
     398\begin{uC++}
     399#include <@iostream@>
     400using namespace std;
     401int i;   double d;   char c;
     402cin >> i >> d >> c;
     403cout << i << ' ' << d << ' ' << c << endl;
     404\end{uC++}
     405&
     406\begin{cfa}
     407#include <@fstream.hfa@>
     408
     409int i;   double d;   char c;
     410sin | i | d | c;
     411sout | i | d | c
     412\end{cfa}
     413\end{tabular}
     414\end{cquote}
     415To disable/enable automatic newline at the end of printing, use @nlOff@/@nlOn@ and @nl@.
     416\begin{cquote}
     417\begin{tabular}{@{}l|l@{}}
     418\begin{uC++}
     419
     420for ( int i = 0; i < 5; i += 1 ) cout << i << ' ';
     421cout << @endl@;
     4220 1 2 3 4
     423\end{uC++}
     424&
     425\begin{cfa}
     426sout | @nlOff@; // disable auto nl
     427for ( i; 5 ) sout | i;
     428sout | @nl@; sout | @nlOn@;  // enable auto nl
     4290 1 2 3 4
     430\end{cfa}
     431\end{tabular}
     432\end{cquote}
     433Floating-point numbers without a fraction print with a decimal point, which can be disabled with @nodp@.
     434\begin{cquote}
     435\begin{tabular}{@{}l|l@{}}
     436\begin{uC++}
     437cout << 3.0 << ' ' << showpoint << setprecision(0) << 3.0 << endl;
     4383 3.
     439\end{uC++}
     440&
     441\begin{cfa}
     442sout | @nodp( 3.0 )@ | 3.0;
     4433 3.
     444\end{cfa}
     445\end{tabular}
     446\end{cquote}
     447
     448
     449\section{String}
     450
     451\begin{cquote}
     452\begin{tabular}{@{}l|l@{}}
     453\multicolumn{2}{@{}l@{}}{\lstinline{string s1, s2;}} \\
     454\begin{uC++}
     455s1 = "abcdefg";
     456s2 = s1;
     457s1 += s2;
     458s1 == s2; s1 != s2;
     459s1 < s2;  s1 <= s2;  s1 > s2;  s1 >= s2;
     460s1.length();
     461s1[3];
     462s1.substr( 2 );  s1.substr( 2, 3 );
     463s1.replace( 2, 5, s2 );
     464s1.find( s2 );
     465s1.find_first_of( "cd" );
     466s1.find_first_not_of( "cd" );
     467getline( cin, s1 );
     468cout << s1 << endl;
     469\end{uC++}
     470&
     471\begin{cfa}
     472s1 = "abcdefg";
     473s2 = s1;
     474s1 += s2;
     475s1 == s2; s1 != s2;
     476s1 < s2;  s1 <= s2;  s1 > s2;  s1 >= s2;
     477len( s1 );
     478s1[3];
     479s1( 2 );  s1( 2, 3 );
     480s1( 2, 5 ) = s2;
     481find( s1, s2 );
     482exclude( s1, "cd" );  // longest sequence excluding "c" and "d"
     483include( s1, "cd" );  // longest sequence including "c" and "d"
     484sin | getline( s1 );
     485sout | s1;
     486\end{cfa}
     487\end{tabular}
     488\end{cquote}
     489
     490
     491\section{\texorpdfstring{\lstinline{uArray}}{uArray}}
     492
     493\begin{cquote}
     494\begin{tabular}{@{}l|l@{}}
     495\begin{uC++}
     496#include <iostream>
     497using namespace std;
     498
     499struct S {
     500        int i;
     501        S( int i ) { S::i = i; }
     502};
     503void f( uArrayRef( S, parm ) );
     504int main() {
     505        enum { N = 5 };
     506        @uArray( S, s, N );@   // stack, no ctor calls
     507        for ( int i = 0; i < N; i += 1 ) @s[i]( i )@; // ctor calls
     508        for ( int i = 0; i < N; i += 1 ) cout << s[i]@->@i << endl;
     509        f( s );
     510        @uArrayPtr( S, sp, N );@   // heap, no ctor calls
     511        for ( int i = 0; i < N; i += 1 ) @sp[i]( i )@; // ctor calls
     512        for ( int i = 0; i < N; i += 1 ) cout << sp[i]@->@i << endl;
     513        f( sp );
     514} // delete s, sp
     515\end{uC++}
     516&
     517\begin{cfa}
     518#include <fstream.hfa>
     519#include <array.hfa>
     520#include <memory.hfa>
     521struct S {
     522        int i;
     523};
     524void ?{}( S & s, int i ) { s.i = i; }
     525forall( [N] ) void f( array( S, N ) & parm ) {}
     526int main() {
     527        enum { N = 5 };
     528        @array( S, N ) s = { delay_init };@ // no ctor calls
     529        for ( i; N ) @s[i]{ i }@; // ctor calls
     530        for ( i; N ) sout | s[i]@.@i;
     531        f( s );
     532    @unique_ptr( array( S, N ) )@ sp = { delay_init }; // heap
     533    for ( int i = 0; i < N; i += 1 ) @(*sp)@[i]{ i }; // ctor calls
     534    for ( int i = 0; i < N; i += 1 ) sout | @(*sp)@[i].i;
     535        f( @*sp@ );
     536} // delete s, sp
     537\end{cfa}
     538\end{tabular}
     539\end{cquote}
     540
     541
     542\section{\texorpdfstring{Structures (object-oriented \protect\vs routine style)}{Structures (object-oriented vs. routine style)}}
     543
     544\begin{cquote}
     545\begin{tabular}{@{}l|l@{}}
     546\begin{uC++}
     547struct S {
     548        int i = 0;  // cheat, implicit default constructor
     549        int setter( int j ) { int t = i; i = j; return t; }
     550        int getter() { return i; }
     551};
     552S s;
     553@s.@setter( 3 );  // object calls
     554int k = @s.@getter();
     555\end{uC++}
     556&
     557\begin{cfa}
     558struct S {  int i;  };
     559void ?{}( S & s ) { s.i = 0; } // explicit default constructor
     560int setter( @S & s,@ int j ) @with( s )@ { int t = i; i = j; return t; }
     561int getter( @S & s@ ) @with( s )@ { return i; }
     562
     563S s;
     564setter( @s,@ 3 );  // normal calls
     565int k = getter( @s@ );
     566\end{cfa}
     567\end{tabular}
     568\end{cquote}
     569
     570
    391571\section{Constructor / Destructor}
    392572
     
    421601void @?{}@( S & s ) { s.i = s.j = 3; } $\C[3in]{// default}$
    422602void @?{}@( S & s, int i, int j ) { s.i = i; s.j = j; } $\C{// initializer}$
    423 void @?{}@( S & s, const S rhs ) { s.[i,j] = rhs.[i,j]; } $\C{// copy}$
     603void @?{}@( S & s, const S rhs ) { ?{}( s, rhs.i, rhs.j ); } $\C{// copy}$
    424604void @^?{}@( S & s ) { s.i = 0; s.j = 0; } $\C{// destructor}\CRT$
    425605
     
    440620
    441621
    442 \section{\texorpdfstring{Structures (object-oriented \protect\vs routine style)}{Structures (object-oriented vs. routine style)}}
    443 
    444 \begin{cquote}
    445 \begin{tabular}{@{}l|l@{}}
    446 \begin{uC++}
    447 struct S {
    448         int i = 0;  // cheat, implicit default constructor
    449         int setter( int j ) { int t = i; i = j; return t; }
    450         int getter() { return i; }
    451 };
    452 S s;
    453 @s.@setter( 3 );  // object calls
    454 int k = @s.@getter();
    455 \end{uC++}
    456 &
    457 \begin{cfa}
    458 struct S {  int i;  };
    459 void ?{}( S & s ) { s.i = 0; } // explicit default constructor
    460 int setter( @S & s,@ int j ) @with( s )@ { int t = i; i = j; return t; }
    461 int getter( @S & s@ ) @with( s )@ { return i; }
    462 
    463 S s;
    464 setter( @s,@ 3 );  // normal calls
    465 int k = getter( @s@ );
    466 \end{cfa}
    467 \end{tabular}
    468 \end{cquote}
    469 
    470 
    471 \section{String}
    472 
    473 \begin{cquote}
    474 \begin{tabular}{@{}l|l@{}}
    475 \multicolumn{2}{@{}l@{}}{\lstinline{string s1, s2;}} \\
    476 \begin{uC++}
    477 s1 = "abcdefg";
    478 s2 = s1;
    479 s1 += s2;
    480 s1 == s2; s1 != s2;
    481 s1 < s2; s1 <= s2; s1 > s2; s1 >= s2;
    482 s1.length();
    483 s1[3];
    484 s1.substr( 2 ); s1.substr( 2, 3 );
    485 s1.replace( 2, 5, s2 );
    486 s1.find( s2 ); s1.rfind( s2 );
    487 s1.find_first_of( s2 ); s1.find_last_of( s2 );
    488 s1.find_first_not_of( s2 ); s1.find_last_not_of( s2 );
    489 getline( cin, s1 );
    490 cout << s1 << endl;
    491 \end{uC++}
    492 &
    493 \begin{cfa}
    494 s1 = "abcdefg";
    495 s2 = s1;
    496 s1 += s2;
    497 s1 == s2; s1 != s2;
    498 s1 < s2; s1 <= s2; s1 > s2; s1 >= s2;
    499 size( s1 );
    500 s1[3];
    501 s1( 2 ); s1( 2, 3 );
    502 // replace( s1, 2, 5, s2 );
    503 // find( s1, s2 ), rfind( s1, s2 );
    504 // find_first_of( s2 ); find_last_of( s2 );
    505 // find_first_not_of( s1, s2 ); find_last_not_of( s1, s2 );
    506 sin | getline( s1 );
    507 sout | s1;
    508 \end{cfa}
    509 \end{tabular}
    510 \end{cquote}
    511 
    512 
    513 \section{\texorpdfstring{\lstinline{uArray}}{uArray}}
    514 
    515 \begin{cquote}
    516 \begin{tabular}{@{}l|l@{}}
    517 \begin{uC++}
    518 #include <iostream>
    519 using namespace std;
    520 struct S {
    521         int i;
    522         S( int i ) { S::i = i; cout << "ctor " << S::i << endl; }
    523         ~S() { S::i = i; cout << "dtor " << S::i << endl; }
    524 };
    525 int main() {
    526         enum { N = 5 };
    527         @uArray( S, s, N );@   // no constructor calls
    528         for ( int i = 0; i < N; i += 1 ) @s[i]( i )@; // constructor calls
    529         for ( int i = 0; i < N; i += 1 ) cout << s[i]@->@i << endl;
    530 }
    531 \end{uC++}
    532 &
    533 \begin{cfa}
    534 #include <fstream.hfa>
    535 #include <array.hfa>
    536 struct S {
    537         int i;
    538 };
    539 void ?{}( S & s, int i ) { s.i = i; sout | "ctor" | s.i; }
    540 void ^?{}( S & s ) { sout | "dtor" | s.i; }
    541 int main() {
    542         enum { N = 5 };
    543         @array( S, N ) s = { delay_init };@ // no constructor calls
    544         for ( i; N ) @s[i]{ i }@; // constructor calls
    545         for ( i; N ) sout | s[i]@.@i;
    546 }
    547 \end{cfa}
    548 \end{tabular}
    549 \end{cquote}
    550 
    551 
    552622\section{Coroutine}
    553623
     
    760830#include <locks.hfa>
    761831owner_lock m;
    762 condition_variable( owner_lock ) s;  // generic type on mutex lock
     832cond_lock( owner_lock ) s;  // generic type on mutex lock
    763833lock( m );
    764834if ( ! empty( s ) ) wait( s, m );
     
    799869enum { N = 3 };
    800870Barrier b{ N };
    801 
    802 _Task T {
    803         void main() {
    804                 for ( int i = 0; i < 10; i += 1 ) {
    805                         b.block( 1 );
    806                 }
    807         }
    808 };
    809 int main() {
    810         uProcessor p[N - 1];
    811         T t[N];
    812 }
    813871\end{uC++}
    814872&
     
    836894enum { N = 3 };
    837895Barrier b{ N };
    838 
    839 thread T {};
    840 void main( T & ) {
    841         for ( 10 ) {
    842                 block( b, 1 );
    843         }
    844 }
    845 
    846 int main() {
    847         processor p[N - 1];
    848         T t[N];
    849 }
    850896\end{cfa}
    851897\end{tabular}
Note: See TracChangeset for help on using the changeset viewer.