In C# I can write something like this: enum MyEnum : byte { Value1, Value2, Value3 } and the integral type of MyEnum will be byte.
In Objective-C I want the size of MyEnum to be 1 byte. How can I do it?
In C# I can write something like this: enum MyEnum : byte { Value1, Value2, Value3 } and the integral type of MyEnum will be byte.
In Objective-C I want the size of MyEnum to be 1 byte. How can I do it?
You can't do it, the underlying type for enums will be chosen for you by the compiler.
If you need specific sizes, use a suitable type (e.g. uint8_t
) for your variables and make sure the values in the enumeration fit in that types value range.