Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: What is your opinion about unsigned int u = -2 ? Date: Sun, 11 Aug 2024 14:53:50 -0700 Organization: None to speak of Lines: 25 Message-ID: <87wmkmenf5.fsf@nosuchdomain.example.com> References: <87bk2cecan.fsf@bsb.me.uk> <87r0b6g3qx.fsf@nosuchdomain.example.com> <87jzgxdv9x.fsf@nosuchdomain.example.com> <86mslin5gc.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sun, 11 Aug 2024 23:53:50 +0200 (CEST) Injection-Info: dont-email.me; posting-host="4e0a7955da0737aad349c16a734eea4d"; logging-data="3057144"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OommxH526/CKmKANVbZRz" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:A1n+gfGJNizDO5RYNw0yth4xMZo= sha1:gSrfQiULyRafkAXS8uVeEwaBmGo= Xref: csiph.com comp.lang.c:387487 Tim Rentsch writes: > Keith Thompson writes: > >> Thiago Adams writes: >> >>> More samples.. >>> max uint64 + 1 is signed 128 bits in gcc and unsigned long long in clang >>> >>> #ifdef __clang__ >>> static_assert(TYPE_IS(9223372036854775808, unsigned long long )); >>> #else >>> static_assert(TYPE_IS(9223372036854775808, __int128)); >>> #endif >>> >>> https://godbolt.org/z/hveY44ov4 >> >> 9223372036854775808 is 2**63, or INT64_MAX-1, not UINT64_MAX-1. > > Of course you meant INT64_MAX + 1 (and presumably UINT64_MAX + 1). Yes, thanks. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */