From owner-svn-src-head@FreeBSD.ORG Sun Jul 25 19:55:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32B38106564A; Sun, 25 Jul 2010 19:55:15 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 0BAC88FC14; Sun, 25 Jul 2010 19:55:14 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id D126B582C5; Sun, 25 Jul 2010 14:55:13 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id ll-lyXMvDQur; Sun, 25 Jul 2010 14:55:13 -0500 (CDT) Received: from wanderer.tachypleus.net (ASt-Lambert-154-1-36-154.w90-61.abo.wanadoo.fr [90.61.171.154]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 70EC1582C3; Sun, 25 Jul 2010 14:55:12 -0500 (CDT) Message-ID: <4C4C969E.1060602@freebsd.org> Date: Sun, 25 Jul 2010 21:55:10 +0200 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.10) Gecko/20100627 Thunderbird/3.0.5 MIME-Version: 1.0 To: Kostik Belousov References: <201007241814.o6OIEY4K099556@svn.freebsd.org> <20100724183732.GA1715@mole.fafoe.narf.at> <20100726013202.G11808@delplex.bde.org> <20100725181255.GB22295@deviant.kiev.zoral.com.ua> In-Reply-To: <20100725181255.GB22295@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Stefan Farfeleder , src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r210451 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jul 2010 19:55:15 -0000 On 07/25/10 20:12, Kostik Belousov wrote: > On Mon, Jul 26, 2010 at 01:36:07AM +1000, Bruce Evans wrote: > >> On Sat, 24 Jul 2010, Stefan Farfeleder wrote: >> >> >>> declaring enums like this is not standard C code (seems to be a GCC >>> extension). I don't think we should use this feature in our headers. >>> >> This is unfortunate. This is because the size of an enum variable >> depends on its complete declaration. This is an error unconditionaly >> with TenDRA. It takes -pedantic to get a warning from gcc. >> > I looked at the C99, and indeed, there is an explicit sentence > "A type specifier of the form enum identifier without an enumerator list > shall only appear after the type it specifies is complete." > > I fully agree with Bruce that this is unfortunate, or rather, makes > enum tag declaration completely unuseful. gcc extension greatly simplifies > dealing with the headers pollution. > > On the other hand, I disagree with the statement that the size of the > enum variable depends on the full declaration. It seems that C99 > defines values of the enum to by of type int, and both i386 and > amd64 ABIs define enums as represented by 4-byte integers. > Yes, I am aware that C++ allows the enum to be assigned the > the shortest arithmetic type that can represent all enum values. > This is not actually true. Try adding a value that requires a 64-bit int to your enum -- it will become 8 bytes. Also, the signedness of the type depends on the values in the enumeration. -Nathan