[cfe-dev] How to declare an enum type with a specific size

Mark Schimmel marksl at synopsys.com
Thu Jan 16 16:03:57 PST 2014


I want to define an enum with sizeof()==1 in C without using any command line options that apply to all enums.  Something like:

  typedef enum  { MINVAL=-128, MAXVAL=127 } E8_t;

I'd like to apply an __attribute__ to it that would tell the compiler to make it's size 8 bits.  Is this already possible in Clang?  I tried __attribute__((packed)) but get an error.
Thanks


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140117/0a88867d/attachment.html>


More information about the cfe-dev mailing list