[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lost information converting decoded value to in32_t
From: |
Wolfgang Lux |
Subject: |
Re: Lost information converting decoded value to in32_t |
Date: |
Tue, 26 May 2020 11:05:37 +0200 |
> Am 25.05.2020 um 23:57 schrieb Riccardo Mottola <address@hidden>:
>
> What is interesting, if gdb follows the same literal rules and promotions of
> GCC:
>
> (gdb) p (int64_t)-2147483648
> $8 = 2147483648
> (gdb) p (int64_t)-2147483648l
> $9 = 2147483648
> (gdb) p (int64_t)-2147483648L
> $10 = 2147483648
>
> (gdb) p (int64_t)-2147483647
> $15 = -2147483647
>
> Whatever I do as a literal suffix, it comes out positive. One value less and
> it works.
Well, you've missed out the one that should have worked :-)
-2147483648LL
Note that suffix L mark a long value, which is just 32 bits on a 32-bit system
the long type. So to get a 64-bit literal you need to ask for a long long value.
Wolfgang