cvs commit: src/usr.sbin/nologin nologin.c

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jan 5 05:49:55 PST 2005


On Tue, Jan 04, 2005 at 11:11:07PM +0000, Robert Watson wrote:
> I ran into exactly the same problem I assume Xin Li is now running into
> just a few days ago: gcc warns if argc and argv are unused in the main() 
> definition if they aren't referenced when running at higher WARNS levels. 
> I would argue this is a bug in gcc, since main() is part of an API calling
> convention, and it doesn't matter if the arguments are unused by the
> function -- they are still provided by the caller.  But then, I'm not a C
> expert, so maybe this opinion is the result of poor breeding? :-) 

ISO C99, 5.1.2.2.1 allows two prototypes for main:
int main(void);
int main(int argc, char *argv[]);

GCC correctly enforces this. IMO the first is better than using __unused
for both parameters, but I'm not a FreeBSD commiter :)

Joerg

> 
> Robert N M Watson


More information about the cvs-src mailing list