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

Robert Watson rwatson at freebsd.org
Tue Jan 4 15:14:47 PST 2005


On Tue, 4 Jan 2005, Maxime Henrion wrote:

> Xin LI wrote:
> > delphij     2005-01-04 20:07:12 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     usr.sbin/nologin     nologin.c 
> >   Log:
> >   Use __unused macro instead of a bare void for main().
> >   
> >   Suggested by:   nectar
> 
> I bet there is a reason behind this, but I'm totally puzzled at why you
> would do such a thing.  It was much prettier and more "C" before.  Could
> you shed some light on this please? 

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? :-) 

Robert N M Watson




More information about the cvs-src mailing list