[cfe-dev] MS 128-bit literals don't always have the correct type

Dmitri Gribenko gribozavr at gmail.com
Sun Sep 23 12:18:58 PDT 2012

On Sun, Sep 23, 2012 at 10:15 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Sun, Sep 23, 2012 at 2:27 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> On Sun, Sep 23, 2012 at 9:24 PM, Cory Nelson <phrosty at gmail.com> wrote:
>>> On Sun, Sep 23, 2012 at 11:20 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>>> Hello,
>>>> Currently Clang chooses the type of MS 128-bit literals (<digits>i128,
>>>> <digits>ui128) based on their value, as if there was no suffix, but
>>>> also allows an extended 128-bit type.
>>>> For example, on x86_64:
>>>> 1i128 is equivalent to 1,
>>>> 0x100000000i128 is same as 0x100000000L,
>>>> and finally 0x10000000000000000i128 is indeed a 128-bit literal.
>>>> I don't know if it is intended, but i128 is definitely treated
>>>> differently way from other MS literal suffixes we accept (for example,
>>>> i64 is essentially an alias for LL).
>>>> I don't have Visual Studio so I can not check how it handles these literals.
>>> VC++ does not support 128-bit literals.
>> I'm confused.  So why does Clang implement them?
> There's an __int128 supplied by gcc
> (http://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html), but there's
> not one for Visual Studio (at least not one officially documented).

That is a 128-bit integer type.  I was asking about 128-bit literals,
like 1i128 (which gcc does not support).


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the cfe-dev mailing list