Bruno Haible <[EMAIL PROTECTED]> writes: > Hey, 'int' is a flexible data type!
I agree, though for this particular example I find the code easier to read if the test is ordered numerically, and if an if-then-else expression is used. So, instead of this: if (flags >= 16) type = TYPE_U32_STRING; else if (flags >= 8) type = TYPE_U16_STRING; else type = TYPE_U8_STRING; I might use something like the following, say. type = (flags < 8 ? TYPE_U8_STRING : flags < 16 ? TYPE_U16_STRING : TYPE_U32_STRING); Or if you prefer 'int' idioms I might do it this way: type = TYPE_U8_STRING + (8 <= flags) + (16 <= flags); as this is faster and smaller on many platforms. (But this is a very small point of course. To each his own.)