Deutsch   English   Français   Italiano  
<v9b8c0$2sac4$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.misty.com!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups: comp.lang.c
Subject: Re: What is your opinion about unsigned int u = -2 ?
Date: Sun, 11 Aug 2024 16:53:20 -0400
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v9b8c0$2sac4$1@dont-email.me>
References: <v8dfo9$1k7cg$1@dont-email.me> <87mslxe4wj.fsf@bsb.me.uk>
 <86y152n9c8.fsf@linuxsc.com> <v9b5od$2rta7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 11 Aug 2024 22:53:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="72297cd42be756146f5f0043d692be33";
	logging-data="3025284"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX183zUoKPycJ22XEzgPIY66KYJD6KbYGa4g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rW9Il0pSTfVjUOxC7qNP7222Jvo=
In-Reply-To: <v9b5od$2rta7$1@dont-email.me>
Content-Language: en-US
Bytes: 1687

On 8/11/24 16:08, Vir Campestris wrote:
....
> "Converting -1 to an unsigned type always sets all the bits"
> 
> In any normal twos complement architecture that's the case. But there 
> are a few oddballs out there where -1 is +1, except that the dedicated 
> sign bit is set.

There may be hardware where that is true, but a conforming
implementation of C targeting that hardware cannot use the hardware's
result. It must fix up the result produced by the hardware to match the
result required by the C standard.