Article View: comp.std.c
Article #18Re: What is the value of `(unsigned) -1' ??
From: Jos Horsmeier
Date: Wed, 28 Oct 1992 10:33
Date: Wed, 28 Oct 1992 10:33
24 lines
1334 bytes
1334 bytes
In article <17583@ksr.com> jfw@ksr.com (John F. Woods) writes: |jos@and.nl (Jos Horsmeier) writes: |>On (normal?) two complement implementations nothing happens, i.e. |>the bit pattern remains the same as it was. If the size of an |>unsigned int is larger than the size of a signed int, there will |>occur sign bit extension, e.g. sizeof(int) = 2; sizeof(unsigned int) = 4. | |3.1.2.5 Types "For each of the signed integer types, there is a corresponding |(but different) _unsigned integer type_ (designated with the keyword |*unsigned*) that uses the same amount of storage (including sign information) |and has the same alignment requirements." Ah, yes. I was a bit sloppy by saying it that way. I should have written something like: `If the size of an unsigned integral type is larger than the size of the original signed integral number ... '. This applies to: short int i= -1; unsigned long l; l= (unsigned long)i; kind regards, Jos aka jos@and.nl
Technical Details
Message-ID:
<3753@dozo.and.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!and!josReferences:
<1992Oct27.071744.4871@netcom.com> <3745@dozo.and.nl> <17583@ksr.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!and!jos From: jos@and.nl (Jos Horsmeier) Newsgroups: comp.std.c Subject: Re: What is the value of `(unsigned) -1' ?? Message-ID: <3753@dozo.and.nl> Date: 28 Oct 92 10:33:08 GMT References: <1992Oct27.071744.4871@netcom.com> <3745@dozo.and.nl> <17583@ksr.com> Organization: AND Software BV Rotterdam Lines: 24