2002-07-19 19:50:31

by Joseph Malicki

[permalink] [raw]
Subject: Re: close return value

It's an issue when it MIGHT be important. Such as, fprintf to an important
data file should be checked, fprintf to stderr is usually cool not to check.

People are going on the assumption that ignoring an error to a system call
will interfere with program operation or corrupt data - which is NOT
necessarily true. Sure many people write programs that way. But it is
quite often that if something fails, you don't particularly care, and you
know, with certainty, that it does not materially affect the operation of
your program. For instance, should shutdown fail just because it couldn't
write a message to everyone's console? That would be wonderful.
Administrator wants to shut down system because it is broken - but since a
programmer follows your mantras, the system CANNOT
successfully shutdown anyway because then it wouldn't be "reliable".

-joe

----- Original Message -----
From: "Arnaldo Carvalho de Melo" <[email protected]>
To: "Lars Marowsky-Bree" <[email protected]>
Cc: "Patrick J. LoPresti" <[email protected]>; "Joseph Malicki"
<[email protected]>; <[email protected]>
Sent: Friday, July 19, 2002 3:30 PM
Subject: Re: close return value


> Em Fri, Jul 19, 2002 at 09:25:24PM +0200, Lars Marowsky-Bree escreveu:
> > On 2002-07-19T14:48:44,
> > "Patrick J. LoPresti" <[email protected]> said:
> >
> > > Of course, checking errors in order to handle them sanely is a good
> > > thing. Nobody is arguing that. What I am arguing is that failing to
> > > check errors when they can "never happen" is wrong.
> >
> > Actually, checking for _all_ even remotely possible and checkable error
> > conditions (if the check doesn't incur an intolerable overhead) is a
very very
> > important requirement for writing high quality code; even if it isn't
"fault
>
> If the function is not to be checked for errors, lets make it return void
and
> be done with it. There are few _exceptions_, but one has to understand the
> meaning of that word 8)
>
> - Arnaldo
>


2002-07-19 19:52:37

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: close return value

Em Fri, Jul 19, 2002 at 03:45:40PM -0400, Joseph Malicki escreveu:
> programmer follows your mantras, the system CANNOT
> successfully shutdown anyway because then it wouldn't be "reliable".

Oh well, look at the word _exceptions_ in my post.

- Arnaldo

2002-07-20 18:22:30

by Bernd Eckenfels

[permalink] [raw]
Subject: Re: close return value

In article <[email protected]> you wrote:
> It's an issue when it MIGHT be important. Such as, fprintf to an important
> data file should be checked, fprintf to stderr is usually cool not to check.

well, writing to stdout/stderr can fail with a normal IO Error. It depends
on what kind of data you actually output. If it is a log message and you are
sure you do not need intact audit trails you might ignore it. If you write a
pipe tool (e.g. sort) you better check that write state and terminate.

Greetings
Bernd
yy