* What should be the type of 9223372036854775808L ? unsigned long or signed __int128?
@ 2023-08-08 9:08 Helmut Zeisel
2023-08-08 10:18 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Helmut Zeisel @ 2023-08-08 9:08 UTC (permalink / raw)
To: gcc
GCC13, c++, cygwin 64:
auto x = 9223372036854775808L
gives the warning: "integer constant is so large that it is unsigned"
But actually the type is signed __int128:
std::cout << x;
gives the error: "ambiguous overload for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘__int128’"
and
std::cout << (x-x-1<0) << std::endl;
prints 1.
So what is the correct type of 9223372036854775808L ?
unsigned long, as the warning says, or signed __int128?
Helmut
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: What should be the type of 9223372036854775808L ? unsigned long or signed __int128?
2023-08-08 9:08 What should be the type of 9223372036854775808L ? unsigned long or signed __int128? Helmut Zeisel
@ 2023-08-08 10:18 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2023-08-08 10:18 UTC (permalink / raw)
To: Helmut Zeisel; +Cc: gcc
On Tue, 8 Aug 2023 at 10:09, Helmut Zeisel via Gcc <gcc@gcc.gnu.org> wrote:
>
> GCC13, c++, cygwin 64:
>
> auto x = 9223372036854775808L
>
> gives the warning: "integer constant is so large that it is unsigned"
>
> But actually the type is signed __int128:
>
> std::cout << x;
>
> gives the error: "ambiguous overload for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘__int128’"
>
> and
>
> std::cout << (x-x-1<0) << std::endl;
>
> prints 1.
>
> So what is the correct type of 9223372036854775808L ?
> unsigned long, as the warning says, or signed __int128?
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96788
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-08 10:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 9:08 What should be the type of 9223372036854775808L ? unsigned long or signed __int128? Helmut Zeisel
2023-08-08 10:18 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).