Subject: Re: a few minor cleanups to src/share/misc/style
To: None <tech-kern@netbsd.org, tech-userlevel@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 03/22/2001 15:49:29
[ On Thursday, March 22, 2001 at 08:49:06 (+0000), Alistair Crooks wrote: ]
> Subject: Re: a few minor cleanups to src/share/misc/style
>
> 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]

It would be nice if lint implicitly understood "exit()" to be like "return".

In the mean time I always follow it with a "/* NOTREACHED */" directive

> lint -chapbxzF   a.ln
> Lint pass2:
> printf returns value which is always ignored

This one always creates a dilema for me.  I really do want lint to warn
me when I'm ignoring a function return value.  However I rarely want to
check the return value of printf(), and I do get tired of writing things
like "(void) printf()"....

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>