Subject: Re: Sane exit from a program on receipt of a signal
To: David Laight <david@l8s.co.uk>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 09/24/2007 16:53:29
On Sep 24,  9:21pm, david@l8s.co.uk (David Laight) wrote:
-- Subject: Re: Sane exit from a program on receipt of a signal

| On Mon, Sep 24, 2007 at 11:32:11AM -0400, Christos Zoulas wrote:
| > 
| > Looks good to me. I would only cast the result of memset() to (void)
| > to shut-up lint.
| 
| And I wouldn't because I find those casts make teh code more difficult
| to read.

If this is going to be the way we go, it should be decided formally and
a note to the fact that we don't like void casts should be placed in style.
The rest of the calls in the code do that, and style currently mandates
that we cast to void.

| The worst one is the result of fprintf(), where people are likely to
| start adding code to check for it returning -1 (as was done to config).
| This was all pointless (and removed) since any 'write error' is very
| unlikely to be reported until fflush() or fclose() is called.
| Write errors can be detected by the fflush(); ferror(); fclose(); sequence.

In the end it is just a matter of taste. I like the void's because they
shut up lint and they show the programmers intend. You don't like them
because they clutter the code...

christos