[clean-list] Re: Advice on style, please

John van Groningen johnvg@cs.kun.nl
Mon, 17 Dec 2001 17:07:08 +0100


Alan H. wrote:

>...
>Please erase that example.  It is a defamation of the Clean language.
>The problem can be solved substantially better, e.g. as below.

The boolean yielded by fclose should not be ignored after writing to a file,
even if you use ferror after every write. If the fclose function has to
flush the buffer and it cannot write this buffer to disk, it will return
False to indicate that writing has failed.
If you add this test, you can remove the ferror call in cc.

It would be faster not to use fend each time, but instead read until
freadc yields false, and then use fend, ferror or the boolean returned
by fclose to check for errors.

Regards,
John van Groningen