enum (objective c)

How is this:
typedef NS_ENUM(char, BlenderSpeed){BlenderSpeedStir, BlenderSpeedChop, BlenderSpeedLiquefy };
A space-saving enum?


Piece from my book:
With the old syntax, the compiler would choose an appropriate data type for the enum, usually int. If your enum will only have four options whose values do not matter, you do not need four bytes to store it; one byte will represent integral number up to 255 just fine. revealing from chapter 3 that a char is a one-byte integer, you can declare a space-saving enum:
typedef NS_ENUM(char, BlenderSpeed){BlenderSpeedStir, BlenderSpeedChop, BlenderSpeedLiquefy };
Last edited on
Topic archived. No new replies allowed.