Subject: Re: a few minor cleanups to src/share/misc/style
To: Chris G. Demetriou <cgd@sibyte.com>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-userlevel
Date: 03/22/2001 08:49:06
On Wed, Mar 21, 2001 at 05:53:29PM -0800, Chris G. Demetriou wrote:
> Here are a few minor cleanups to src/share/misc/style:
> 
> * Fix a malformed pair of block comments (lack of space between them),
>   in the way that I think is appropriate: combining them into one.

Not a biggy.
 
> * convert exit codes to use EXIT_SUCCESS and EXIT_FAILURE rather than
>   0 and 1.  (following c89.)

Good.
 
> * explicitly mention that exits from main() should be done via exit(),
>   rather than return.  This was already demonstrated implicitly by the
>   sample code, but probably bears explicit mention.

In this case, the lint libraries will have to be changed:

[8:45:19] agc@db1 ~/lint 37 > cat a.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main(void)
{
        printf("Hello world\n");
        exit(EXIT_SUCCESS);
}
[8:45:21] agc@db1 ~/lint 38 > make lint
lint -chapbxzF  -i a.c
a.c(10): warning: function main falls off bottom without returning value [217]
lint -chapbxzF   a.ln
Lint pass2:
printf returns value which is always ignored
[8:45:24] agc@db1 ~/lint 39 >

(Not that I'm against the change, merely mentioning that that is why some of
the utilities that I write have return's from main()).

Regards,
Alistair