svn commit: r281721 - head/sys/sys

David Chisnall theraven at FreeBSD.org
Tue Apr 21 07:42:59 UTC 2015


On 20 Apr 2015, at 17:19, Bruce Evans <brde at optusnet.com.au> 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);

David



More information about the svn-src-all mailing list