Changeset 3ac5fd8 for doc/user/user.tex


Ignore:
Timestamp:
Aug 17, 2024, 3:15:21 PM (4 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
df2e00f
Parents:
afb15cf
Message:

first attempt changing end-of-file to an exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    rafb15cf r3ac5fd8  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Jul 26 06:56:11 2024
    14 %% Update Count     : 6955
     13%% Last Modified On : Thu Aug 15 22:23:30 2024
     14%% Update Count     : 6957
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    46564656\VRef[Figure]{f:CFACommand-LineProcessing} demonstrates the file operations by showing the idiomatic \CFA command-line processing and copying an input file to an output file.
    46574657Note, a stream variable may be copied because it is a reference to an underlying stream data-structures.
    4658 \Textbf{All I/O errors are handled as exceptions}, but end-of-file is not an exception as C programmers are use to explicitly checking for it.
     4658\Textbf{All unusual I/O cases are handled as exceptions, including end-of-file.}
    46594659
    46604660\begin{figure}
     
    46864686        in | nlOn;                                                              §\C{// turn on reading newline}§
    46874687        char ch;
    4688         for () {                                                                §\C{// read/write characters}§
    4689                 in | ch;
    4690           if ( eof( in ) ) break;                               §\C{// eof ?}§
    4691                 out | ch;
    4692         } // for
     4688        try {
     4689                for () {                                                        §\C{// read/write characters}§
     4690                        in | ch;
     4691                        out | ch;
     4692                } // for
     4693        } catch( end_of_file * ) {                              §\C{// end-of-file raised}§
     4694        } // try
    46934695} // main
    46944696\end{cfa}
Note: See TracChangeset for help on using the changeset viewer.