[cfe-commits] r63945 - /cfe/trunk/lib/Headers/limits.h

Chris Lattner clattner at apple.com
Fri Feb 6 15:30:31 PST 2009


On Feb 6, 2009, at 12:08 PM, Sebastian Redl wrote:
>>
>> +
>> +#define MB_LEN_MAX 1
>>
> " maximum number of bytes in a multibyte character, for any supported
> locale"
> Do we have any business defining this? Supported locales are a  
> question
> of the C runtime, not the compiler itself. If any supported locale
> supports, say, UTF-8, this should be 4.
>> +
>> +#ifdef __CHAR_UNSIGNED__  /* -funsigned-char */
>> +#define CHAR_MIN ((char)0)
>>
> Is this correct? C99 5.2.4.2.1 says, "the following shall be  
> replaced by
> expressions that have the same type as would an expression that is an
> object of the corresponding type converted according to the integer
> promotions."
> In C, it might not make a difference whether the promotion is already
> done (the expression is of type int) or is done on use, but in C++ it
> does (overloading), and C++ defines limits.h by reference to the C  
> standard.

excellent points, I think r63980 should handle this.  I checked and  
GCC handles MB_LEN_MAX by wrapping it with #ifndefs, I assume this is  
because the system limits.h could define it or something.

Thanks for the review,

-Chris



More information about the cfe-commits mailing list