On Nov 6, 10:55 pm, Jeff Schwab <(E-Mail Removed)> wrote:

> Juha Nieminen wrote:

> > Jeff Schwab wrote:

> >> I've only considered it for two's complement.

> > Exactly how does two's complement representation kick in

> > with unsigned values?

> Are you asking why the representation is relevant? As far as

> I know, all of the representations allowed by the Standard are

> equivalent for purposes of this discussion.
Yes and no. For signed values, the bit pattern of -n will

depend on the representation. For unsigned values, the standard

defines -i to be 2^n-i (where n is the number of value bits in

the unsigned). Which by a curious bit of chance(

) just

happens to correspond to what you'd get for 2's complement

signed values.

> The only one I've really considered is two's complement,

> though. That doesn't mean I think there's any particular

> problem with the other allowed representations, just that I

> don't know enough about them to know whether there are any

> gotchas.
On thing is immediately certain, the bit pattern of -n will

depend on the representation if the type is signed. Which means

that it probably will not work.

--

James Kanze (GABI Software) email:(E-Mail Removed)

Conseils en informatique orientée objet/

Beratung in objektorientierter Datenverarbeitung

9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34