On 01/17/2017 11:48, Benjamin Kaduk wrote:
> On Tue, Jan 17, 2017 at 10:57 AM, Ian Lepore <i...@freebsd.org
> <mailto:i...@freebsd.org>> wrote:
> 
>     In my experience, enums are a superior way to define integer constants
>     (compared to #define), but they are pure poison as variable types in
>     APIs and structures because their size is a compiler implementation
>     choice.
> 
> 
> Well, to some extent. For example, the amd64 sysV ABI says that enum
> types are signed fourbyte, with a footnote that "C++ and some
> implementations of C permit enums larger than an int. The underlying
> type is bumped to an unsigned int, long int or unsigned long int, in
> that order."

And in C++11 and later, you can specify the exact type:

enum color
#if defined(__cplusplus) && __cplusplus >= 201103L
        : int
#endif
{
        blue,
        ...

Eric
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to