[cfe-dev] MS 128-bit literals don't always have the correct type
Aaron Ballman
aaron at aaronballman.com
Mon Sep 24 06:15:17 PDT 2012
On Mon, Sep 24, 2012 at 12:46 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> Incidentally, we currently treat (for instance) 1000000000000000000i32 as a
> 64-bit integer. How does MSVC behave here? (Does i32 mean "this shall be an
> int32_t", or does it mean "this shall be *at least* an int32_t"?)
It seems to mean that it shall be an int32_t. In both 32- and 64-bit compiles.
// 32-bit
; 2 : auto i = 1000000000000000000i32;
mov DWORD PTR _i$[ebp], -1486618624 ; a7640000H
// 64-bit
; 2 : auto i = 1000000000000000000i32;
mov DWORD PTR i$[rsp], -1486618624 ; ffffffffa7640000H
However, I can't find documentation on MSDN to suggest that this is
intended behavior or not. The only integer type suffix documentation
they have lists i64, ll and LL (plus the u variants), but not i32.
http://msdn.microsoft.com/en-us/library/00a1awxf(v=vs.110).aspx
~Aaron
More information about the cfe-dev
mailing list