Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2005 14:49:52 +0100
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        cvs-src@freebsd.org
Subject:   Re: cvs commit: src/usr.sbin/nologin nologin.c
Message-ID:  <20050105134952.GB18921@britannica.bec.de>
In-Reply-To: <Pine.NEB.3.96L.1050104230945.45311j-100000@fledge.watson.org>
References:  <20050104202213.GC63028@elvis.mu.org> <Pine.NEB.3.96L.1050104230945.45311j-100000@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050105134952.GB18921>