> It'd be nice to test that the values are actually correct, as well as that > they are in matching pairs. Something like: > > (unsigned char)SCHAR_MIN == (unsigned char)SCHAR_MAX + 1 > > ... should do the trick.
How about: _Static_assert(SCHAR_MAX == UCHAR_MAX/2, ""); _Static_assert(SHRT_MAX == USHRT_MAX/2, ""); _Static_assert(INT_MAX == UINT_MAX/2, ""); _Static_assert(LONG_MAX == ULONG_MAX/2, ""); Matched pairs make sure signed min/max are consistent, unsigned max are correct by casting all-ones, and the four I propose make sure signed max is correct. > Maybe: > > #else > > int LLONG_MIN, LLONG_MAX, ULLONG_MAX; // not defined Done. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
