🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2202

Re: this unsigned business

#2202
From: Henry Spencer
Date: Sat, 03 Oct 1992 22:37
16 lines
1214 bytes
In article <1992Oct2.163051.26791@waggen.twuug.com> alpha@waggen.twuug.com (Joe Wright) writes:
>Casting an int to unsigned does not change the representation.

Wrong.  Casting a *positive* int to unsigned does not change the
representation.  Casting a negative int might have to, because the
results of this cast are very precisely defined but the representation
of negative integers is not.  No change of representation is needed
on two's-complement machines.  Machines which use one's-complement or
signed-magnitude representations for integers *will* have to change
the data bits in such a case.

Yes, Virginia, a cast is a *conversion*, not a "view the bits differently"
operator.
-- 
There is nothing wrong with making      | Henry Spencer @ U of Toronto Zoology
mistakes, but... make *new* ones. -D.Sim|  henry@zoo.toronto.edu  utzoo!henry
Technical Details
Message-ID: <BvKHHy.LL5@zoo.toronto.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!utzoo!henry
References: <BvFo8x.Jq1@twwells.com> <1992Oct2.163051.26791@waggen.twuug.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: this unsigned business
Message-ID: <BvKHHy.LL5@zoo.toronto.edu>
Date: Sat, 3 Oct 1992 22:37:09 GMT
References: <BvFo8x.Jq1@twwells.com> <1992Oct2.163051.26791@waggen.twuug.com>
Organization: U of Toronto Zoology
Lines: 16