From owner-cvs-src@FreeBSD.ORG Thu Jan 6 14:59:12 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39A8B16A4CE for ; Thu, 6 Jan 2005 14:59:12 +0000 (GMT) Received: from mail.freebsd.org.cn (dns3.freebsd.org.cn [61.129.66.75]) by mx1.FreeBSD.org (Postfix) with SMTP id 2504543D54 for ; Thu, 6 Jan 2005 14:59:05 +0000 (GMT) (envelope-from delphij@frontfree.net) Received: (qmail 70015 invoked by uid 0); 6 Jan 2005 14:51:38 -0000 Received: from unknown (HELO beastie.frontfree.net) (219.239.99.7) by mail.freebsd.org.cn with SMTP; 6 Jan 2005 14:51:38 -0000 Received: from localhost (localhost.frontfree.net [127.0.0.1]) by beastie.frontfree.net (Postfix) with ESMTP id EBACD13387E; Thu, 6 Jan 2005 22:58:55 +0800 (CST) Received: from beastie.frontfree.net ([127.0.0.1]) by localhost (beastie.frontfree.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01211-12; Thu, 6 Jan 2005 22:58:44 +0800 (CST) Received: by beastie.frontfree.net (Postfix, from userid 1001) id 4DB1C1337D1; Thu, 6 Jan 2005 22:58:43 +0800 (CST) Date: Thu, 6 Jan 2005 22:58:43 +0800 From: Xin LI To: Paul Richards Message-ID: <20050106145843.GA1855@frontfree.net> References: <20050104202213.GC63028@elvis.mu.org> <20050106104356.GB52159@clan.nothing-going-on.org> <20050106115705.GO16316@myrddin.originative.co.uk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20050106115705.GO16316@myrddin.originative.co.uk> User-Agent: Mutt/1.4.2.1i X-GPG-key-ID/Fingerprint: 0xCAEEB8C0 / 43B8 B703 B8DD 0231 B333 DC28 39FB 93A0 CAEE B8C0 X-GPG-Public-Key: http://www.delphij.net/delphij.asc X-Operating-System: FreeBSD beastie.frontfree.net 5.3-delphij FreeBSD 5.3-delphij #11: Tue Oct 26 14:12:03 CST 2004 delphij@beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386 X-URL: http://www.delphij.net X-By: delphij@beastie.frontfree.net X-Location: Beijing, China X-Virus-Scanned: by amavisd-new at frontfree.net cc: src-committers@freebsd.org cc: Maxime Henrion cc: cvs-src@freebsd.org cc: Nik Clayton cc: cvs-all@freebsd.org cc: Robert Watson cc: Xin LI Subject: Re: cvs commit: src/usr.sbin/nologin nologin.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2005 14:59:12 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Paul, On Thu, Jan 06, 2005 at 11:57:06AM +0000, Paul Richards wrote: > On Thu, Jan 06, 2005 at 10:43:56AM +0000, Nik Clayton wrote: > > On Tue, Jan 04, 2005 at 11:11:07PM +0000, Robert Watson wrote: > > > On Tue, 4 Jan 2005, Maxime Henrion wrote: > > > > 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?=20 > > >=20 > > > I ran into exactly the same problem I assume Xin Li is now running in= to > > > just a few days ago: gcc warns if argc and argv are unused in the mai= n()=20 > > > definition if they aren't referenced when running at higher WARNS lev= els.=20 > > > I would argue this is a bug in gcc, since main() is part of an API ca= lling > > > 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? :-)=20 > >=20 > > What's wrong with (the perfectly legal): > >=20 > > int > > main(void) > > { > > ... > > } > >=20 > > or does gcc complain about that too? >=20 > No it doesn't and it seems to me to be more correct than using a gcc macr= o. __unused is a FreeBSD macro IIRC. I have a rough statistic before committing the revision 1.6: %find bin sbin usr.bin usr.sbin libexec -name '*.c' | xargs grep "main(" | = grep :main | grep void | wc -l 5 %find bin sbin usr.bin usr.sbin libexec -name '*.c' | xargs grep "main(" | = grep :main | grep __unused | wc -l =20 9 My rationale of having main(void) is that both argc and argv are not supposed to be used in any way in nologin(8), while main(void) is my habit when dealing with these situations. However, since there is no written style guidelines about main(), with the above statistic result, and I think Jacques has more experience on these issues, I have accepted his suggestion. Cheers, --=20 Xin LI http://www.delphij.net/ See complete headers for GPG key and other information. --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB3VIj/cVsHxFZiIoRAgQQAJ9TDjY7kH/W8dMj39udMnaIN3NWywCdHvoW Cdfrc7l/ij4JgUMj3LT3Ul8= =RtSg -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU--