[cfe-dev] linux build fix

Chris Lattner clattner at apple.com
Sun Dec 9 15:05:06 PST 2007


On Dec 9, 2007, at 2:38 PM, Neil Booth wrote:

> Chris Lattner wrote:-
>
>> #define CHAR_BIT  __builtin_config_info("target_char_bit")
>> #define SCHAR_MAX __builtin_config_info("target_schar_max")
>
> Hmm, sounds familiar :)

Yep, we discussed this awhile back.

>> The 'risk' to this is that it will change the preprocessed output of
>> the compiler vs GCC.  For example, something silly like this will
>> expand differently.
>>
>> #define foo(x) # x
>>
>> foo(CHAR_BIT);
>>
>> However, anything that relies on that is dangerously non-conformant
>> anyway, so I don't feel too bad about breaking it :)
>
> ?  That always produces "CHAR_BIT".  If you an extra level of
> indirection, so that it is actually expanded, presumably you and
> GCC would get "8" each too.  I don't see a problem here.

Oh right, duh. :)

-Chris



More information about the cfe-dev mailing list