🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #8

Re: What is the value of `(unsigned) -1' ??

#8
From: Michael Meissner
Date: Tue, 27 Oct 1992 12:12
22 lines
1501 bytes
In article <1992Oct27.071744.4871@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:

| 
| The Subject line say it all.  I've read section 3.2.1.2 and it appears that
| the authors of the ANSI/ISO C standard went out of their way to define
| the value of every conceivable arithmetic conversion *except* the conversion
| of a negative signed integral value to an unsigned integral value of the
| same size.
| 
| If anyone has evidence to the contrary, please share it.  (Please don't
| provide opinions... provide citations instead.  Thanks.)

That's because it is implementation defined.  In a two's complement
32-bit system, (unsigned)-1 returns 0xffffffff.  In a one's complement
32-bit system, (unsigned)-1 returns 0xfffffffe.  In a sign/magnitude
32-bit system, (unsigned)-1 returns 0x80000001.

--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

You are in a twisty little passage of standards, all conflicting.
Technical Details
Message-ID: <MEISSNER.92Oct27121234@tiktok.osf.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!paperboy.osf.org!meissner
References: <1992Oct27.071744.4871@netcom.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!paperboy.osf.org!meissner
From: meissner@osf.org (Michael Meissner)
Subject: Re: What is the value of `(unsigned) -1' ??
In-Reply-To: rfg@netcom.com's message of Tue, 27 Oct 1992 07:17:44 GMT
Message-ID: <MEISSNER.92Oct27121234@tiktok.osf.org>
Sender: news@osf.org (USENET News System)
Organization: Open Software Foundation
References: <1992Oct27.071744.4871@netcom.com>
Date: 27 Oct 92 12:12:34
Lines: 22