As I know C enum is unsigned integer, but this may vary by implementation.
What type should I use for the enum in binary representation?
*PS
‘binary representation’ means byte-array. I want to serialize enum values to socket to inter-operate with other programs.
It’s up to the compiler to use an
intto represent anenumtype, or alongif anintis not sufficient to hold all the values of theenum.If you know that all your
enumvalues can be represented by anint, then you can safely useintas the binary representation of yourenumvalues.