Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Representing signed values in corresponding unsigned types Date: Sat, 15 Aug 2026 02:19:20 -0700 Organization: A noiseless patient Spider Lines: 18 Message-ID: <86fr0f68rr.fsf@linuxsc.com> References: <111qs0g$3hdko$1@dont-email.me> <86zf0e7ox4.fsf@linuxsc.com> <111shlo$3vq40$2@kst.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 15 Aug 2026 09:19:25 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3444149"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+B/aP0k7vcUkfHCYtI7iImtjVekHmST2E="; posting-host="f88cfb7384c39afe54609bf3101f3803" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:OGJJdI7nkhjsFqAcPV8Wk5wWl7o= sha1:BRAPVKnPu+xUW/50CdWnS8jVvoE= sha256:X9up1QAwJhK1YYAaHXY95dW6uQk1XeYEj/EBLyCygf0= sha1:a8SWkV+fC+oWoJTSJjW4vWuT+co= sha256:tYk/5iwQhfUPoV7IT3N5ZdpyJMD8yOj/+4AMGMVNfUs= Xref: csiph.com comp.lang.c:401204 Keith Thompson writes: > Tim Rentsch writes: > >> NS writes: >> >>> Can all the values of a signed int be represented in an unsigned >>> int (or signed long in an unsigned long, etc.)? > > Obviously not. Negative values cannot be represented in unsigned > types. But I don't think that's what NS meant. The question is Can all the values of a signed int be represented in an unsigned int? The question is not can an unsigned int hold all the values of a signed int. An apple, an orange, and a banana can represent the integers 1, 2, and 3. All the values of a signed int can be represented in an unsigned int, as long as UINT_MAX is greater than INT_MAX.