enum Type {INT, SHORT, CHAR, BOOL, DOUBLE, FLOAT}; int mySizeOf(Type t) { switch(t) { case INT : return sizeof(int); case SHORT: // ... // ... } }