[cfe-dev] Patch for arbitrary fixed-width integer types

Douglas Gregor dgregor at apple.com
Sat Feb 7 19:33:08 PST 2009


On Feb 7, 2009, at 6:47 PM, Chris Lattner wrote:

>
> On Feb 6, 2009, at 8:28 PM, Eli Friedman wrote:
>
>> Patch attached.  The reason I'm sending this to cfe-dev rather than
>> just committing it is that it's a substantial new chunk of code,  
>> and I
>> want to make sure it's something we really want; the potential users
>> are rather limited.
>
> Nifty.
>
> In  lib/Sema/SemaDeclAttr.cpp, it seems that you could simplify the
> code by doing something like this before the switch:
>
> if (IntegerMode) {
>   NewTy = S.Context.getFixedWidthIntType(size, OldTy-
>> isSignedIntegerType());
> } else {
>   switch ()...
>
>> The attached patch adds one user for the new fixed-width types: the
>> implementation of the mode attribute.  That said, this is probably
>> overkill for that particular use, and it might confuse code that uses
>> function overloading.
>
> This sounds like a good use for it.  I'm not too concerned with C++
> overloading for attribute(mode).  I have never seen attribute mode
> used with C++ code.

I suggest that we just call all of these conversions "Integral  
conversions" so that they get conversion rank. It won't let anyone do  
fancy overloading with them, but they'll behave sanely in C++.

	- Doug



More information about the cfe-dev mailing list