From owner-svn-src-all@FreeBSD.ORG Tue Apr 21 09:59:06 2015 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7FF9BE2; Tue, 21 Apr 2015 09:59:06 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18F0A1F6F; Tue, 21 Apr 2015 09:59:05 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3L9x086034723 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 21 Apr 2015 12:59:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3L9x086034723 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3L9x0WV034722; Tue, 21 Apr 2015 12:59:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Apr 2015 12:59:00 +0300 From: Konstantin Belousov To: Bruce Evans Cc: David Chisnall , John Baldwin , Justin Hibbits , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r281721 - head/sys/sys Message-ID: <20150421095900.GL2390@kib.kiev.ua> References: <201504190033.t3J0XMDX041769@svn.freebsd.org> <476583045.Qcb6O2DFtY@ralph.baldwin.cx> <20150421020808.D10623@besplex.bde.org> <785A553E-317E-4C80-83A0-567C80697ED8@FreeBSD.org> <20150421184157.Y2048@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150421184157.Y2048@besplex.bde.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2015 09:59:06 -0000 On Tue, Apr 21, 2015 at 07:32:30PM +1000, Bruce Evans wrote: > On Tue, 21 Apr 2015, David Chisnall wrote: > > > On 20 Apr 2015, at 17:19, Bruce Evans wrote: > >> > >> Enums should never be used in ABIs, since their size can be anything > >> large enough. > > > > The rules for the size of enums also differ between C and C++, though clang (and, I think, gcc) support an attribute for specifying the enum type. > > > >> They also cause namespace problems. The whole enum declaration must > >> be exposed in any header that uses an enum type. > > > > Both C and C++ permit forward declarations of enums for use in function prototypes and so on, e.g.: > > > > enum foo; > > void > > bar(enum foo); > > No, they cannot do this since the size may depend on the internals of the > enum: > > TendDRA-5.0.0: > "z.c", line 1: Error: > [ISO C90 6.5.2.3]: Can't declare the enumeration 'enum foo'. > This is not true for C. The i386 ABI specification, from year _1997_, states that enum must be 4-bytes unsigned entity, 4-bytes aligned. See page 28 of abi386-4.pdf.