- Timestamp:
- Oct 13, 2023, 7:13:21 PM (2 years ago)
- Branches:
- master
- Children:
- a97b9ed, bab2917
- Parents:
- 85034ed (diff), 0bf0b978 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- doc
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/LaTeXmacros/common.sty
r85034ed r8cbe732 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sun Jul 16 08:28:52202314 %% Update Count : 58 613 %% Last Modified On : Fri Sep 29 16:48:59 2023 14 %% Update Count : 587 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 272 272 \setlength{\gcolumnposn}{2.75in} 273 273 \setlength{\columnposn}{\gcolumnposn} 274 \newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn} 274 275 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}} 275 276 \newcommand{\CRT}{\global\columnposn=\gcolumnposn} … … 302 303 literate= 303 304 {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 304 {^}{\raisebox{0.6ex}{$\scripts criptstyle\land\,$}}1305 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1 305 306 {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 306 307 {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1 -
doc/LaTeXmacros/common.tex
r85034ed r8cbe732 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Fri Jul 21 09:02:00202314 %% Update Count : 5 7613 %% Last Modified On : Fri Sep 29 16:49:02 2023 14 %% Update Count : 590 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 275 275 \setlength{\gcolumnposn}{2.75in} 276 276 \setlength{\columnposn}{\gcolumnposn} 277 \newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn} 277 278 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}} 278 279 \newcommand{\CRT}{\global\columnposn=\gcolumnposn} … … 301 302 showlines=true, % show blank lines at end of code 302 303 aboveskip=4pt, % spacing above/below code block 303 belowskip= 0pt,304 belowskip=2pt, 304 305 numberstyle=\footnotesize\sf, % numbering style 305 306 % replace/adjust listing characters that look bad in sanserif 306 307 literate= 307 308 {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 308 {^}{\raisebox{0.6ex}{$\scripts criptstyle\land\,$}}1309 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1 309 310 {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 310 311 {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1 -
doc/LaTeXmacros/lstlang.sty
r85034ed r8cbe732 8 8 %% Created On : Sat May 13 16:34:42 2017 9 9 %% Last Modified By : Peter A. Buhr 10 %% Last Modified On : T ue May 2 08:52:35 202311 %% Update Count : 3 010 %% Last Modified On : Thu Sep 21 08:40:05 2023 11 %% Update Count : 31 12 12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 13 … … 134 134 morekeywords={ 135 135 _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch, _CatchResume, _CorActor, _Cormonitor, _Coroutine, 136 _Disable, _Else, _Enable, _Event, _ Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,136 _Disable, _Else, _Enable, _Event, _Exception, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask, 137 137 _Resume, _ResumeTop, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw}, 138 138 } -
doc/bibliography/pl.bib
r85034ed r8cbe732 4113 4113 title = {High-Performance Extended Actors}, 4114 4114 journal = spe, 4115 year = 2022, 4116 note = {submitted July 2022}, 4115 year = 2023, 4116 month = sep, 4117 note = {\url{https://onlinelibrary.wiley.com/doi/pdf/10.1002/spe.3262}} 4117 4118 } 4118 4119 -
doc/user/user.tex
r85034ed r8cbe732 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Aug 10 21:24:07202314 %% Update Count : 5 57013 %% Last Modified On : Sat Sep 30 22:46:19 2023 14 %% Update Count : 5658 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 65 65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 66 67 \setlength{\gcolumnposn}{3in}68 67 \CFAStyle % use default CFA format-style 68 \setgcolumn{2.25in} 69 69 %\lstset{language=CFA} % CFA default lnaguage 70 70 \lstnewenvironment{C++}[1][] % use C++ style … … 224 224 \setlength{\tabcolsep}{10pt} 225 225 \begin{tabular}{@{}rcccccccc@{}} 226 & 202 1 & 2016 & 2011 & 2006 & 2001 & 1996 & 1991 & 1986\\ \hline227 \RB{C} & \RB{1}& \RB{2}& \RB{2}& \RB{1}& \RB{1}& \RB{1}& \RB{1}& \RB{1}\\228 Java & 2 & 1 & 1 & 2 & 3 & 28 & - & -\\229 Python & 3 & 5 & 6 & 7 & 23 & 13 & - & -\\230 \CC & 4 & 3 & 3 & 3 & 2 & 2 & 2 & 8\\226 & 2023 & 2018 & 2013 & 2008 & 2003 & 1998 & 1993 & 1988 \\ \hline 227 Python & 1 & 4 & 8 & 7 & 12 & 25 & 18 & - \\ 228 \RB{C} & \RB{2}& \RB{2}& \RB{1}& \RB{2}& \RB{2}& \RB{1}& \RB{1}& \RB{1}\\ 229 C++ & 3 & 3 & 4 & 4 & 3 & 2 & 2 & 4 \\ 230 Java & 4 & 1 & 2 & 1 & 1 & 18 & - & - \\ 231 231 \end{tabular} 232 232 \end{center} … … 465 465 \Indexc{-h}\index{translator option!-h@{©-h©}}, \Indexc{--help}\index{translator option!--help@{©--help©}} \, print translator help message 466 466 \item 467 \Indexc{-i}\index{translator option!-i@{©-i©}}, \Indexc{--invariant}\index{translator option!--invariant@{©--invariant©}} \, invariant checking during AST passes 468 \item 467 469 \Indexc{-l}\index{translator option!-l@{©-l©}}, \Indexc{--libcfa}\index{translator option!--libcfa@{©--libcfa©}} \, generate ©libcfa.c© 468 470 \item … … 482 484 \begin{description}[topsep=0pt,itemsep=0pt,parsep=0pt] 483 485 \item 484 \Indexc{ascodegen}\index{translator option!-P@{©-P©}!©ascodegen©}\index{translator option!--print@{©-print©}!©ascodegen©} \, as codegen rather than AST485 \item 486 \Indexc{asterr}\index{translator option!-P@{©-P©}!©asterr©}\index{translator option!--print@{©-print©}!©asterr©} \, AST on error487 \item 488 \Indexc{declstats}\index{translator option!-P@{©-P©}!©declstats©}\index{translator option!--print@{©-print©}!©declstats©} \, code property statistics489 \item 490 \Indexc{parse}\index{translator option!-P@{©-P©}!©parse©}\index{translator option!--print@{©-print©}!©parse©} \, yacc (parsing) debug information486 \Indexc{ascodegen}\index{translator option!-P@{©-P©}!©ascodegen©}\index{translator option!--print@{©-print©}!©ascodegen©} \, print AST as codegen rather than AST 487 \item 488 \Indexc{asterr}\index{translator option!-P@{©-P©}!©asterr©}\index{translator option!--print@{©-print©}!©asterr©} \, print AST on error 489 \item 490 \Indexc{declstats}\index{translator option!-P@{©-P©}!©declstats©}\index{translator option!--print@{©-print©}!©declstats©} \, print code property statistics 491 \item 492 \Indexc{parse}\index{translator option!-P@{©-P©}!©parse©}\index{translator option!--print@{©-print©}!©parse©} \, print yacc (parsing) debug information 491 493 \item 492 494 \Indexc{pretty}\index{translator option!-P@{©-P©}!©pretty©}\index{translator option!--print@{©-print©}!©pretty©} \, prettyprint for ©ascodegen© flag … … 494 496 \Indexc{rproto}\index{translator option!-P@{©-P©}!©rproto©}\index{translator option!--print@{©-print©}!©rproto©} \, resolver-proto instance 495 497 \item 496 \Indexc{rsteps}\index{translator option!-P@{©-P©}!©rsteps©}\index{translator option!--print@{©-print©}!©rsteps©} \, resolver steps497 \item 498 \Indexc{ tree}\index{translator option!-P@{©-P©}!©tree©}\index{translator option!--print@{©-print©}!©tree©} \, parse tree499 \item 500 \Indexc{ ast}\index{translator option!-P@{©-P©}!©ast©}\index{translator option!--print@{©-print©}!©ast©} \, AST after parsing501 \item 502 \Indexc{symevt}\index{translator option!-P@{©-P©}!©symevt©}\index{translator option!--print@{©-print©}!©symevt©} \, symbol table events503 \item 504 \Indexc{ altexpr}\index{translator option!-P@{©-P©}!©altexpr©}\index{translator option!--print@{©-print©}!©altexpr©} \, alternatives for expressions505 \item 506 \Indexc{ astdecl}\index{translator option!-P@{©-P©}!©astdecl©}\index{translator option!--print@{©-print©}!©astdecl©} \,AST after declaration validation pass507 \item 508 \Indexc{ resolver}\index{translator option!-P@{©-P©}!©resolver©}\index{translator option!--print@{©-print©}!©resolver©} \,before resolver step509 \item 510 \Indexc{ astexpr}\index{translator option!-P@{©-P©}!©astexpr©}\index{translator option!--print@{©-print©}!©altexpr©} \,AST after expression analysis511 \item 512 \Indexc{ctordtor}\index{translator option!-P@{©-P©}!©ctordtor©}\index{translator option!--print@{©-print©}!©ctordtor©} \, after ctor/dtor are replaced513 \item 514 \Indexc{tuple}\index{translator option!-P@{©-P©}!©tuple©}\index{translator option!--print@{©-print©}!©tuple©} \, after tuple expansion515 \item 516 \Indexc{ astgen}\index{translator option!-P@{©-P©}!©astgen©}\index{translator option!--print@{©-print©}!©astgen©} \,AST after instantiate generics517 \item 518 \Indexc{b ox}\index{translator option!-P@{©-P©}!©box©}\index{translator option!--print@{©-print©}!©box©} \, before box step519 \item 520 \Indexc{ codegen}\index{translator option!-P@{©-P©}!©codegen©}\index{translator option!--print@{©-print©}!©codegen©} \,before code generation498 \Indexc{rsteps}\index{translator option!-P@{©-P©}!©rsteps©}\index{translator option!--print@{©-print©}!©rsteps©} \, print resolver steps 499 \item 500 \Indexc{ast}\index{translator option!-P@{©-P©}!©ast©}\index{translator option!--print@{©-print©}!©ast©} \, print AST after parsing 501 \item 502 \Indexc{excpdecl}\index{translator option!-P@{©-P©}!©excpdecl©}\index{translator option!--print@{©-print©}!©excpdecl©} \, print AST after translating exception decls 503 \item 504 \Indexc{symevt}\index{translator option!-P@{©-P©}!©symevt©}\index{translator option!--print@{©-print©}!©symevt©} \, print AST after symbol table events 505 \item 506 \Indexc{expralt}\index{translator option!-P@{©-P©}!©expralt©}\index{translator option!--print@{©-print©}!©expralt©} \, print AST after expressions alternatives 507 \item 508 \Indexc{valdecl}\index{translator option!-P@{©-P©}!©valdecl©}\index{translator option!--print@{©-print©}!©valdecl©} \, print AST after declaration validation pass 509 \item 510 \Indexc{bresolver}\index{translator option!-P@{©-P©}!©bresolver©}\index{translator option!--print@{©-print©}!©bresolver©} \, print AST before resolver step 511 \item 512 \Indexc{expranly}\index{translator option!-P@{©-P©}!©expranly©}\index{translator option!--print@{©-print©}!©expranly©} \, print AST after expression analysis 513 \item 514 \Indexc{ctordtor}\index{translator option!-P@{©-P©}!©ctordtor©}\index{translator option!--print@{©-print©}!©ctordtor©} \, print AST after ctor/dtor are replaced 515 \item 516 \Indexc{tuple}\index{translator option!-P@{©-P©}!©tuple©}\index{translator option!--print@{©-print©}!©tuple©} \, print AST after tuple expansion 517 \item 518 \Indexc{instgen}\index{translator option!-P@{©-P©}!©instgen©}\index{translator option!--print@{©-print©}!©instgen©} \, print AST after instantiate generics 519 \item 520 \Indexc{bbox}\index{translator option!-P@{©-P©}!©bbox©}\index{translator option!--print@{©-print©}!©bbox©} \, print AST before box pass 521 \item 522 \Indexc{bcodegen}\index{translator option!-P@{©-P©}!©bcodegen©}\index{translator option!--print@{©-print©}!©bcodegen©} \, print AST before code generation 521 523 \end{description} 522 524 \item … … 535 537 Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism: 536 538 \begin{cfa} 537 int ®``®coroutine = 3; 539 int ®``®coroutine = 3; $\C{// make keyword an identifier}$ 538 540 double ®``®forall = 3.5; 539 541 \end{cfa} … … 545 547 \begin{cfa} 546 548 // include file uses the CFA keyword "with". 547 #if ! defined( with ) 548 #define with ®``®with 549 #if ! defined( with ) $\C{// nesting ?}$ 550 #define with ®``®with $\C{// make keyword an identifier}$ 549 551 #define __CFA_BFD_H__ 550 552 #endif 551 $\R{\#include\_next} <bfdlink.h>$ 553 $\R{\#include\_next} <bfdlink.h>$ $\C{// must have internal check for multiple expansion}$ 552 554 #if defined( with ) && defined( __CFA_BFD_H__ ) $\C{// reset only if set}$ 553 555 #undef with … … 564 566 Numeric constants are extended to allow \Index{underscore}s\index{constant!underscore} as a separator, \eg: 565 567 \begin{cfa} 566 2®_®147®_®483®_®648; 567 56®_®ul; 568 0®_®377; 569 0x®_®ff®_®ff; 570 0x®_®ef3d®_®aa5c; 571 3.141®_®592®_®654; 572 10®_®e®_®+1®_®00; 573 0x®_®ff®_®ff®_®p®_®3; 574 0x®_®1.ffff®_®ffff®_®p®_®128®_®l; 568 2®_®147®_®483®_®648; $\C{// decimal constant}$ 569 56®_®ul; $\C{// decimal unsigned long constant}$ 570 0®_®377; $\C{// octal constant}$ 571 0x®_®ff®_®ff; $\C{// hexadecimal constant}$ 572 0x®_®ef3d®_®aa5c; $\C{// hexadecimal constant}$ 573 3.141®_®592®_®654; $\C{// floating constant}$ 574 10®_®e®_®+1®_®00; $\C{// floating constant}$ 575 0x®_®ff®_®ff®_®p®_®3; $\C{// hexadecimal floating}$ 576 0x®_®1.ffff®_®ffff®_®p®_®128®_®l; $\C{// hexadecimal floating long constant}$ 575 577 L®_®$"\texttt{\textbackslash{x}}$®_®$\texttt{ff}$®_®$\texttt{ee}"$; $\C{// wide character constant}$ 576 578 \end{cfa} … … 602 604 603 605 There are exponentiation operators for integral and floating types, including the builtin \Index{complex} types. 604 Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication \footnote{The multiplication computation is $O(\log y)$.} (or shifting if the exponent is 2).606 Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication ($O(\log y)$ multiplies or shifting if the exponent is 2). 605 607 Overflow for a large exponent or negative exponent returns zero. 606 608 Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the exponent cannot be negative. 607 609 \begin{cfa} 608 sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1 609 | (1.0f+2.0fi) ®\® (3.0f+2.0fi); 610 sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi); 610 611 1 1 256 -64 125 ®0® 3273344365508751233 ®0® ®0® -0.015625 18.3791736799526 0.264715-1.1922i 611 612 \end{cfa} … … 620 621 T ?®\®?( T ep, unsigned long int y ); 621 622 \end{cfa} 622 Theuser type ©T© must define multiplication, one (©1©), and ©*©.623 A user type ©T© must define multiplication, one (©1©), and ©*©. 623 624 624 625 … … 634 635 Declarations in the \Indexc{do}-©while© condition are not useful because they appear after the loop body.} 635 636 \begin{cfa} 636 if ( ®int x = f()® ) ... 637 if ( ®int x = f(), y = g()® ) ... 637 if ( ®int x = f()® ) ... $\C{// x != 0}$ 638 if ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$ 638 639 if ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$ 639 640 if ( ®struct S { int i; } x = { f() }; x.i < 4® ) $\C{// relational expression}$ 640 641 641 while ( ®int x = f()® ) ... 642 while ( ®int x = f()® ) ... $\C{// x != 0}$ 642 643 while ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$ 643 644 while ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$ … … 653 654 \label{s:caseClause} 654 655 655 C restricts the \Indexc{case} clause of a\Indexc{switch} statement to a single value.656 For multiple ©case© clauses associated with the samestatement, it is necessary to have multiple ©case© clauses rather than multiple values.656 C restricts a \Indexc{case} clause in \Indexc{switch} statement to a single value. 657 For multiple ©case© clauses prefixing a statement within the ©switch© statement, it is necessary to have multiple ©case© clauses rather than multiple values. 657 658 Requiring a ©case© clause for each value is not in the spirit of brevity normally associated with C. 658 659 Therefore, the ©case© clause is extended with a list of values. 659 660 \begin{cquote} 660 661 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}} 661 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\ 662 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}} \\ 663 \begin{cfa} 664 switch ( i ) { 665 case 1: case 3 : case 5: 666 ... 667 case 2: case 4 : case 6: 668 ... 669 } 670 \end{cfa} 671 & 662 672 \begin{cfa} 663 673 switch ( i ) { … … 670 680 & 671 681 \begin{cfa} 672 switch ( i ) {673 case 1: case 3 : case 5:674 ...675 case 2: case 4 : case 6:676 ...677 }678 \end{cfa}679 &680 \begin{cfa}681 682 682 683 // odd values … … 688 689 \end{tabular} 689 690 \end{cquote} 690 In addition, subranges are allowed to specify case values.\footnote{ 691 gcc has the same mechanism but awkward syntax, \lstinline{2 ...42}, because a space is required after a number, otherwise the period is a decimal point.} 691 In addition, subranges are allowed to specify case values. 692 \begin{cquote} 693 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{\hspace{2em}}l@{}} 694 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{©gcc©}} \\ 692 695 \begin{cfa} 693 696 switch ( i ) { 694 case ®1~5:® $\C{// 1, 2, 3, 4, 5}$697 case 1: case 2: case 3: case 4: 695 698 ... 696 case ®10~15:® $\C{// 10, 11, 12, 13, 14, 15}$699 case 10: case 11: case 12: case 13: 697 700 ... 698 701 } 699 702 \end{cfa} 700 Lists of subranges are also allowed. 703 & 704 \begin{cfa} 705 switch ( i ) { 706 case ®1~4:® 707 ... 708 case ®10~13:® 709 ... 710 } 711 \end{cfa} 712 & 713 \begin{cfa} 714 switch ( i ) { 715 case 1$\R{\textvisiblespace}$®...®4: 716 ... 717 case 10$\R{\textvisiblespace}$®...®13: 718 ... 719 } 720 \end{cfa} 721 & 722 \begin{cfa} 723 724 // 1, 2, 3, 4 725 726 // 10, 11, 12, 13 727 728 729 \end{cfa} 730 \end{tabular} 731 \end{cquote} 732 While ©gcc© has the same range mechanism, it has an awkward syntax, ©2©\R{\textvisiblespace}©...42©, because a space is required after a number, otherwise the period is a decimal point. 733 734 \CFA also allows lists of subranges. 701 735 \begin{cfa} 702 736 case ®1~5, 12~21, 35~42®: … … 769 803 This situation is better handled by a list of case values \see{\VRef{s:caseClause}}. 770 804 While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from most programming languages with a ©switch© statement. 771 Hence, default fall-through semantics results in a large number ofprogramming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.805 Hence, default fall-through semantics results in a many programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through. 772 806 773 807 \item … … 846 880 and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound. 847 881 \end{itemize} 848 These observations put into perspective the \CFA changes to the ©switch© .882 These observations put into perspective the \CFA changes to the ©switch© statement. 849 883 \begin{enumerate} 850 884 \item … … 888 922 \begin{cfa} 889 923 switch ( x ) { 890 ®int i = 0;® 924 ®int i = 0;® $\C{// allowed only at start}$ 891 925 case 0: 892 926 ... 893 ®int j = 0;® 927 ®int j = 0;® $\C{// disallowed}$ 894 928 case 1: 895 929 { 896 ®int k = 0;® 930 ®int k = 0;® $\C{// allowed at different nesting levels}$ 897 931 ... 898 ®case 2:® 932 ®case 2:® $\C{// disallow case in nested statements}$ 899 933 } 900 934 ... … … 907 941 908 942 The \Indexc{fallthrough} clause may be non-terminating within a \Indexc{case} clause or have a target label to common code from multiple case clauses. 909 \begin{c enter}943 \begin{cquote} 910 944 \begin{tabular}{@{}lll@{}} 911 945 \begin{cfa} … … 957 991 \end{cfa} 958 992 \end{tabular} 959 \end{c enter}993 \end{cquote} 960 994 The target label must be below the \Indexc{fallthrough} and may not be nested in a control structure, and 961 995 the target label must be at the same or higher level as the containing \Indexc{case} clause and located at … … 964 998 965 999 \begin{figure} 966 \begin{tabular}{@{}l@{\hspace{ 40pt}}|l@{}}967 \multicolumn{1}{@{}c@{\hspace{ 40pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\1000 \begin{tabular}{@{}l@{\hspace{50pt}}|l@{}} 1001 \multicolumn{1}{@{}c@{\hspace{50pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\ 968 1002 \hline 969 1003 \begin{cfa} … … 1083 1117 The \Indexc{for}, \Indexc{while}, and \Indexc{do} loop-control allow an empty conditional, which implies a comparison value of ©1© (true). 1084 1118 \begin{cfa} 1085 while ( ®/* empty*/® )$\C{// while ( true )}$1086 for ( ®/* empty*/® )$\C{// for ( ; true; )}$1087 do ... while ( ®/* empty*/® )$\C{// do ... while ( true )}$1119 while ( ®/* empty */® ) $\C{// while ( true )}$ 1120 for ( ®/* empty */® ) $\C{// for ( ; true; )}$ 1121 do ... while ( ®/* empty */® ) $\C{// do ... while ( true )}$ 1088 1122 \end{cfa} 1089 1123 … … 1115 1149 If no type is specified for the loop index, it is the type of the high value H (when the low value is implicit) or the low value L. 1116 1150 \begin{cfa} 1117 for ( ®5® ) $\C{// typeof(5) anonymous-index; 5 is high value}$1118 for ( i; ®1.5® ~ 5.5 ) $\C{// typeof(1.5) i; 1.5 is low value}$1119 for ( ®int i®; 0 ~ 10 ~ 2 ) $\C{// int i; type is explicit}$1151 for ( ®5® ) $\C{// typeof(5) anonymous-index; 5 is high value}$ 1152 for ( i; ®1.5® ~ 5.5 ) $\C{// typeof(1.5) i; 1.5 is low value}$ 1153 for ( ®int i®; 0 ~ 10 ~ 2 ) $\C{// int i; type is explicit}$ 1120 1154 \end{cfa} 1121 1155 … … 1125 1159 H is implicit up-to exclusive range [0,H\R{)}. 1126 1160 \begin{cfa} 1127 for ( ®5® ) $\C{// for ( typeof(5) i; i < 5; i += 1 )}$1161 for ( ®5® ) $\C{// for ( typeof(5) i; i < 5; i += 1 )}$ 1128 1162 \end{cfa} 1129 1163 \item 1130 1164 ©~=© H is implicit up-to inclusive range [0,H\R{]}. 1131 1165 \begin{cfa} 1132 for ( ®~=® 5 ) $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$1166 for ( ®~=® 5 ) $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$ 1133 1167 \end{cfa} 1134 1168 \item 1135 1169 L ©~©\index{~@©~©} H is explicit up-to exclusive range [L,H\R{)}. 1136 1170 \begin{cfa} 1137 for ( 1 ®~® 5 ) $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$1171 for ( 1 ®~® 5 ) $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$ 1138 1172 \end{cfa} 1139 1173 \item 1140 1174 L ©~=©\index{~=@©~=©} H is explicit up-to inclusive range [L,H\R{]}. 1141 1175 \begin{cfa} 1142 for ( 1 ®~=® 5 ) $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$1176 for ( 1 ®~=® 5 ) $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$ 1143 1177 \end{cfa} 1144 1178 \item 1145 1179 L ©-~©\index{-~@©-~©} H is explicit down-to exclusive range [H,L\R{)}, where L and H are implicitly interchanged to make the range down-to. 1146 1180 \begin{cfa} 1147 for ( 1 ®-~® 5 ) $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$1181 for ( 1 ®-~® 5 ) $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$ 1148 1182 \end{cfa} 1149 1183 \item 1150 1184 L ©-~=©\index{-~=@©-~=©} H is explicit down-to inclusive range [H,L\R{]}, where L and H are implicitly interchanged to make the range down-to. 1151 1185 \begin{cfa} 1152 for ( 1 ®-~=® 5 ) $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$1186 for ( 1 ®-~=® 5 ) $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$ 1153 1187 \end{cfa} 1154 1188 \item 1155 1189 ©@© means put nothing in this field. 1156 1190 \begin{cfa} 1157 for ( i; 1 ~ ®@® ~ 2 ) $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$1158 for ( i; 1 ~ 10 ~ ®@® ) $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$1159 for ( i; 1 ~ ®@® ~ ®@® ) $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$1191 for ( i; 1 ~ ®@® ~ 2 ) $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$ 1192 for ( i; 1 ~ 10 ~ ®@® ) $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$ 1193 for ( i; 1 ~ ®@® ~ ®@® ) $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$ 1160 1194 \end{cfa} 1161 1195 L cannot be elided for the up-to range, \lstinline{@ ~ 5}, and H for the down-to range, \lstinline{1 -~ @}, because then the loop index is uninitialized. … … 1164 1198 ©:© means low another index. 1165 1199 \begin{cfa} 1166 for ( i; 5 ®:® j; 2 ~ 12 ~ 3 ) $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$1200 for ( i; 5 ®:® j; 2 ~ 12 ~ 3 ) $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$ 1167 1201 \end{cfa} 1168 1202 \end{itemize} 1169 1203 \R{Warning}: specifying the down-to range maybe unexpected because the loop control \emph{implicitly} switches the L and H values (and toggles the increment/decrement for I): 1170 1204 \begin{cfa} 1171 for ( i; 1 ~ 10 ) ${\C[1.5in]{// up range}$1172 for ( i; 1 -~ 10 ) ${\C{// down range}$1173 for ( i; ®10 -~ 1® ) ${\C{// \R{WRONG down range!}}\CRT}$1205 for ( i; 1 ~ 10 ) ${\C{// up range}$ 1206 for ( i; 1 -~ 10 ) ${\C{// down range}$ 1207 for ( i; ®10 -~ 1® ) ${\C{// \R{WRONG down range!}}}$ 1174 1208 \end{cfa} 1175 1209 The reason for this semantics is that the range direction can be toggled by adding/removing the minus, ©'-'©, versus interchanging the L and H expressions, which has a greater chance of introducing errors. … … 1188 1222 1189 1223 \begin{figure} 1190 \centering1191 1224 \begin{lrbox}{\myboxA} 1192 \begin{cfa}[tabsize= 3]1225 \begin{cfa}[tabsize=4] 1193 1226 ®Compound:® { 1194 1227 ®Try:® try { … … 1220 1253 1221 1254 \begin{lrbox}{\myboxB} 1222 \begin{cfa}[tabsize= 3]1255 \begin{cfa}[tabsize=4] 1223 1256 { 1224 1257 … … 1249 1282 \end{lrbox} 1250 1283 1251 \subfloat[ \CFA]{\label{f:CFibonacci}\usebox\myboxA}1284 \subfloat[C]{\label{f:CFAFibonacciGen}\usebox\myboxB} 1252 1285 \hspace{3pt} 1253 1286 \vrule 1254 1287 \hspace{3pt} 1255 \subfloat[ C]{\label{f:CFAFibonacciGen}\usebox\myboxB}1288 \subfloat[\CFA]{\label{f:CFibonacci}\usebox\myboxA} 1256 1289 \caption{Multi-level Exit} 1257 1290 \label{f:MultiLevelExit} … … 1287 1320 int a[10]; 1288 1321 \end{cfa} 1289 \begin{tabular}{@{}l ll@{}}1322 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{3em}}l@{}} 1290 1323 \begin{cfa} 1291 1324 … … 1328 1361 Grouping heterogeneous data into an \newterm{aggregate} (structure/union) is a common programming practice, and aggregates may be nested: 1329 1362 \begin{cfa} 1330 struct Person { $\C{// aggregate}$ 1331 struct Name { char first[20], last[20]; } name $\C{// nesting}$ 1332 struct Address { ... } address $\C{// nesting}$ 1363 struct Person { $\C{// aggregate}$ 1364 struct Name { $\C{// nesting}$ 1365 char first[20], last[20]; 1366 } name; 1367 struct Address { $\C{// nesting}$ 1368 ... 1369 } address; 1333 1370 int sex; 1334 1371 }; … … 1337 1374 \begin{cfa} 1338 1375 Person p 1339 ®p.®name; ®p.®address; ®p.®sex; 1376 ®p.®name; ®p.®address; ®p.®sex; $\C{// access containing fields}$ 1340 1377 \end{cfa} 1341 1378 which extends to multiple levels of qualification for nested aggregates and multiple aggregates. … … 1352 1389 \begin{cfa} 1353 1390 struct S { 1354 struct $\R{\LstCommentStyle{/* unnamed */}}$ { int g, h; } __attribute__(( aligned(64) ));1391 struct $\R{\LstCommentStyle{/* unnamed */}}$ { int g, h; } __attribute__(( aligned(64) )); 1355 1392 int tag; 1356 union $\R{\LstCommentStyle{/* unnamed */}}$ {1393 union $\R{\LstCommentStyle{/* unnamed */}}$ { 1357 1394 struct { char c1, c2; } __attribute__(( aligned(128) )); 1358 1395 struct { int i1, i2; }; … … 1368 1405 struct S { 1369 1406 char ®c®; int ®i®; double ®d®; 1370 void f( /* S * this */ ) { 1371 ®c®; ®i®; ®d®; 1407 void f( /* S * this */ ) { $\C{// implicit ``this'' parameter}$ 1408 ®c®; ®i®; ®d®; $\C{// this->c; this->i; this->d;}$ 1372 1409 } 1373 1410 } … … 1377 1414 \begin{cfa} 1378 1415 struct T { 1379 char ®m®; int ®i®; double ®n®; 1416 char ®m®; int ®i®; double ®n®; $\C{// derived class variables}$ 1380 1417 }; 1381 1418 struct S : public T { 1382 char ®c®; int ®i®; double ®d®; 1419 char ®c®; int ®i®; double ®d®; $\C{// class variables}$ 1383 1420 void g( double ®d®, T & t ) { 1384 d; ®t®.m; ®t®.i; ®t®.n; 1385 c; i; ®this->®d; ®S::®d; 1386 m; ®T::®i; n; 1421 d; ®t®.m; ®t®.i; ®t®.n; $\C{// function parameter}$ 1422 c; i; ®this->®d; ®S::®d; $\C{// class S variables}$ 1423 m; ®T::®i; n; $\C{// class T variables}$ 1387 1424 } 1388 1425 }; … … 1394 1431 Hence, the qualified fields become variables with the side-effect that it is simpler to write, easier to read, and optimize field references in a block. 1395 1432 \begin{cfa} 1396 void f( S & this ) ®with ( this )® { 1397 ®c®; ®i®; ®d®; 1433 void f( S & this ) ®with ( this )® { $\C{// with statement}$ 1434 ®c®; ®i®; ®d®; $\C{// this.c, this.i, this.d}$ 1398 1435 } 1399 1436 \end{cfa} 1400 1437 with the generality of opening multiple aggregate-parameters: 1401 1438 \begin{cfa} 1402 void g( S & s, T & t ) ®with ( s, t )® { 1403 c; ®s.®i; d; 1404 m; ®t.®i; n; 1439 void g( S & s, T & t ) ®with ( s, t )® {$\C{// multiple aggregate parameters}$ 1440 c; ®s.®i; d; $\C{// s.c, s.i, s.d}$ 1441 m; ®t.®i; n; $\C{// t.m, t.i, t.n}$ 1405 1442 } 1406 1443 \end{cfa} … … 1425 1462 struct R { int ®i®; int j; double ®m®; } r, w; 1426 1463 with ( r, q ) { 1427 j + k; 1428 m = 5.0; 1429 m = 1; 1430 int a = m; 1431 double b = m; 1432 int c = r.i + q.i; 1433 (double)m; 1464 j + k; $\C{// unambiguous, r.j + q.k}$ 1465 m = 5.0; $\C{// unambiguous, q.m = 5.0}$ 1466 m = 1; $\C{// unambiguous, r.m = 1}$ 1467 int a = m; $\C{// unambiguous, a = r.i }$ 1468 double b = m; $\C{// unambiguous, b = q.m}$ 1469 int c = r.i + q.i; $\C{// disambiguate with qualification}$ 1470 (double)m; $\C{// disambiguate with cast}$ 1434 1471 } 1435 1472 \end{cfa} … … 1439 1476 \begin{cfa} 1440 1477 with ( r ) { 1441 i; 1478 i; $\C{// unambiguous, r.i}$ 1442 1479 with ( q ) { 1443 i; 1480 i; $\C{// unambiguous, q.i}$ 1444 1481 } 1445 1482 } … … 1448 1485 A cast can also be used to disambiguate among overload variables in a ©with© \emph{expression}: 1449 1486 \begin{cfa} 1450 with ( w ) { ... } 1451 with ( (Q)w ) { ... } 1487 with ( w ) { ... } $\C{// ambiguous, same name and no context}$ 1488 with ( (Q)w ) { ... } $\C{// unambiguous, cast}$ 1452 1489 \end{cfa} 1453 1490 Because there is no left-side in the ©with© expression to implicitly disambiguate between the ©w© variables, it is necessary to explicitly disambiguate by casting ©w© to type ©Q© or ©R©. … … 1456 1493 \begin{cfa} 1457 1494 void f( S & s, char c ) with ( s ) { 1458 ®s.c = c;® i = 3; d = 5.5; 1495 ®s.c = c;® i = 3; d = 5.5; $\C{// initialize fields}$ 1459 1496 } 1460 1497 \end{cfa} … … 1462 1499 To solve this problem, parameters \emph{not} explicitly opened are treated like an initialized aggregate: 1463 1500 \begin{cfa} 1464 struct Params { 1501 struct Params { $\C{// s explicitly opened so S \& s elided}$ 1465 1502 char c; 1466 1503 } params; … … 1481 1518 Transfer of control can be local, within a routine, or non-local, among routines. 1482 1519 Non-local transfer can cause stack unwinding, \ie non-local routine termination, depending on the kind of raise. 1520 1521 Currently, \CFA uses macros ©ExceptionDecl© and ©ExceptionInst© to declare and instantiate an exception. 1522 \begin{cfa} 1523 #include <Exception.hfa> 1524 ®ExceptionDecl®( E, // must be global scope 1525 ... // exception fields 1526 ); 1527 try { 1528 ... 1529 if ( ... ) ®throwResume® ®ExceptionInst®( E, /* intialization */ ); 1530 if ( ... ) ®throw® ®ExceptionInst®( E, /* intialization */ ); 1531 ... 1532 } ®catchResume®( E * ) { // must be pointer 1533 ... 1534 } catch( E * ) { 1535 ... 1536 } 1537 \end{cfa} 1538 1483 1539 \begin{cfa} 1484 1540 exception_t E {}; $\C{// exception type}$ … … 1489 1545 try { 1490 1546 f(...); 1491 } catch( E e ; $boolean-predicate$ ) { 1547 } catch( E e ; $boolean-predicate$ ) { $\C{// termination handler}$ 1492 1548 // recover and continue 1493 1549 } catchResume( E e ; $boolean-predicate$ ) { $\C{// resumption handler}$ … … 1501 1557 The ©catch© and ©catchResume© handlers may appear in any oder. 1502 1558 However, the ©finally© clause must appear at the end of the ©try© statement. 1559 1560 1561 \section{Non-local Exception} 1562 1563 \begin{cfa} 1564 void main() { 1565 try { 1566 _Enable { 1567 ... resume(); ... 1568 } 1569 } ®catchResume®( E & ) { // should be reference 1570 ... 1571 } catch( E & ) { 1572 ... 1573 } 1574 } 1575 \end{cfa} 1503 1576 1504 1577 … … 1566 1639 \begin{cquote} 1567 1640 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 1568 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1641 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ 1642 \begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}] 1643 ®int® #*# x1 #[5]#; 1644 ®int® #(*#x2#)[5]#; 1645 #int (*#f®( int p )®#)[5]#; 1646 \end{cfa} 1647 & 1569 1648 \begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}] 1570 1649 #[5] *# ®int® x1; 1571 1650 #* [5]# ®int® x2; 1572 1651 #[* [5] int]# f®( int p )®; 1573 \end{cfa}1574 &1575 \begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]1576 ®int® #*# x1 #[5]#;1577 ®int® #(*#x2#)[5]#;1578 #int (*#f®( int p )®#)[5]#;1579 1652 \end{cfa} 1580 1653 \end{tabular} … … 1586 1659 \begin{cquote} 1587 1660 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 1588 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1661 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ 1662 \begin{cfa} 1663 int ®*®x, ®*®y; 1664 \end{cfa} 1665 & 1589 1666 \begin{cfa} 1590 1667 ®*® int x, y; 1591 \end{cfa}1592 &1593 \begin{cfa}1594 int ®*®x, ®*®y;1595 1668 \end{cfa} 1596 1669 \end{tabular} … … 1599 1672 \begin{cquote} 1600 1673 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 1601 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1674 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ 1675 \begin{cfa} 1676 int ®*®x, y; 1677 1678 \end{cfa} 1679 & 1602 1680 \begin{cfa} 1603 1681 ®*® int x; 1604 1682 int y; 1605 \end{cfa}1606 &1607 \begin{cfa}1608 int ®*®x, y;1609 1610 1683 \end{cfa} 1611 1684 \end{tabular} … … 1615 1688 \begin{cquote} 1616 1689 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}} 1617 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\ 1690 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}} \\ 1691 \begin{cfa} 1692 int z[ 5 ]; 1693 char * w[ 5 ]; 1694 double (* v)[ 5 ]; 1695 struct s { 1696 int f0:3; 1697 int * f1; 1698 int * f2[ 5 ] 1699 }; 1700 \end{cfa} 1701 & 1618 1702 \begin{cfa} 1619 1703 [ 5 ] int z; … … 1628 1712 & 1629 1713 \begin{cfa} 1630 int z[ 5 ];1631 char * w[ 5 ];1632 double (* v)[ 5 ];1633 struct s {1634 int f0:3;1635 int * f1;1636 int * f2[ 5 ]1637 };1638 \end{cfa}1639 &1640 \begin{cfa}1641 1714 // array of 5 integers 1642 1715 // array of 5 pointers to char … … 1654 1727 \begin{cquote} 1655 1728 \begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}} 1656 \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}} & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\ 1729 \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}} \\ 1730 \begin{cfa} 1731 int const * const x; 1732 const int (* const y)[ 5 ] 1733 \end{cfa} 1734 & 1657 1735 \begin{cfa} 1658 1736 const * const int x; 1659 1737 const * [ 5 ] const int y; 1660 \end{cfa}1661 &1662 \begin{cfa}1663 int const * const x;1664 const int (* const y)[ 5 ]1665 1738 \end{cfa} 1666 1739 & … … 1675 1748 \begin{cquote} 1676 1749 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}} 1677 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\ 1750 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}} \\ 1751 \begin{cfa} 1752 int extern x[ 5 ]; 1753 const int static * y; 1754 \end{cfa} 1755 & 1678 1756 \begin{cfa} 1679 1757 extern [ 5 ] int x; 1680 1758 static * const int y; 1681 \end{cfa}1682 &1683 \begin{cfa}1684 int extern x[ 5 ];1685 const int static * y;1686 1759 \end{cfa} 1687 1760 & … … 1696 1769 \begin{cquote} 1697 1770 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 1698 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1771 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ 1772 \begin{cfa} 1773 y = (int *)x; 1774 i = sizeof(int * [ 5 ]); 1775 \end{cfa} 1776 & 1699 1777 \begin{cfa} 1700 1778 y = (* int)x; 1701 1779 i = sizeof([ 5 ] * int); 1702 \end{cfa}1703 &1704 \begin{cfa}1705 y = (int *)x;1706 i = sizeof(int * [ 5 ]);1707 1780 \end{cfa} 1708 1781 \end{tabular} … … 1899 1972 \begin{cquote} 1900 1973 \begin{tabular}{@{}l@{\hspace{3em}}l@{}} 1901 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} \\ 1974 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{Cy}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ 1975 \begin{cfa} 1976 const int * ®const® * ®const® ccp; 1977 1978 \end{cfa} 1979 & 1902 1980 \begin{cfa} 1903 1981 ®const® * ®const® * const int ccp; 1904 1982 ®const® & ®const® & const int ccr; 1905 \end{cfa}1906 &1907 \begin{cfa}1908 const int * ®const® * ®const® ccp;1909 1910 1983 \end{cfa} 1911 1984 \end{tabular} … … 2068 2141 \begin{cfa} 2069 2142 int x, &r = ®x®, f( int & p ); $\C{// lvalue variable (int) convert to reference (int \&)}$ 2070 f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)} $2143 f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)}\CRT$ 2071 2144 \end{cfa} 2072 2145 Conversion can restrict a type, where ©cv1© $\le$ ©cv2©, \eg passing an ©int© to a ©const volatile int &©, which has low cost. … … 4430 4503 \end{cfa} 4431 4504 To match a minus, put it as the first character, ©"-0-9"©. 4432 Note, other complex forms of regular-expression matching isnot supported.4505 Other complex forms of regular-expression matching are not supported. 4433 4506 4434 4507 The following \Index{manipulator}s control scanning of input values (reading), and only affect the format of the argument. … … 8628 8701 \begin{cquote} 8629 8702 \begin{tabular}{@{}l@{\hspace{\parindentlnth}}|@{\hspace{\parindentlnth}}l@{}} 8630 \multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{ \CFA}} & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{C}} \\8703 \multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{C}} & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{\CFA}} \\ 8631 8704 \hline 8632 \begin{cfa}8633 #include <gmp.hfa>$\indexc{gmp}$8634 int main( void ) {8635 sout | "Factorial Numbers";8636 Int fact = 1;8637 8638 sout | 0 | fact;8639 for ( i; 40 ) {8640 fact *= i;8641 sout | i | fact;8642 }8643 }8644 \end{cfa}8645 &8646 8705 \begin{cfa} 8647 8706 #include <gmp.h>$\indexc{gmp.h}$ … … 8654 8713 ®mpz_mul_ui®( fact, fact, i ); 8655 8714 ®gmp_printf®( "%d %Zd\n", i, fact ); 8715 } 8716 } 8717 \end{cfa} 8718 & 8719 \begin{cfa} 8720 #include <gmp.hfa>$\indexc{gmp}$ 8721 int main( void ) { 8722 sout | "Factorial Numbers"; 8723 Int fact = 1; 8724 8725 sout | 0 | fact; 8726 for ( i; 40 ) { 8727 fact *= i; 8728 sout | i | fact; 8656 8729 } 8657 8730 }
Note:
See TracChangeset
for help on using the changeset viewer.