[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enum may be signed

From: Ken Raeburn
Subject: Re: enum may be signed
Date: Sat, 1 May 2010 14:37:00 -0400

On May 1, 2010, at 13:56, Stefan Monnier wrote:
> Interesting.  I didn't know about that part of the C language.  Is it
> possible to specify that this is an unsigned enum somehow?

Not really... nothing in standard C supports it (in fact IIRC it doesn't allow 
enum bitfields anyways, but that's a common extension), and anything 
MSVC-specific won't help when the next such compiler comes along.

> Of course we can add one more bit (we have plenty of bits left there),
> but I'd first like to know how this is usually handled, since it seems
> to imply that MSVC always requires one extra bit to store enums.

I think adding the extra bit and using "unsigned int" bitfields are the two 
usual ways to deal with it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]