Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2015 08:42:41 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        John Baldwin <jhb@freebsd.org>, Justin Hibbits <jhibbits@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r281721 - head/sys/sys
Message-ID:  <785A553E-317E-4C80-83A0-567C80697ED8@FreeBSD.org>
In-Reply-To: <20150421020808.D10623@besplex.bde.org>
References:  <201504190033.t3J0XMDX041769@svn.freebsd.org> <476583045.Qcb6O2DFtY@ralph.baldwin.cx> <20150421020808.D10623@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 20 Apr 2015, at 17:19, Bruce Evans <brde@optusnet.com.au> wrote:
>=20
> 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);

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?785A553E-317E-4C80-83A0-567C80697ED8>