Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #6853
| From | Kai-Uwe Bux <jkherciueh@gmx.net> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Slow -- VERY slow brain |
| Followup-To | comp.lang.c++ |
| Date | 2011-06-17 18:06 +0200 |
| Organization | University of Bielefeld |
| Message-ID | <itfu31$q44$1@hoshi.visyn.net> (permalink) |
| References | (2 earlier) <61cb1940-6462-4539-965f-0d08de716c0b@r35g2000prj.googlegroups.com> <itdboa$kv4$1@dont-email.me> <86259de8-25e5-4d86-bfda-69f722b1055b@gv8g2000vbb.googlegroups.com> <itdpg3$nfl$1@dont-email.me> <bdeb67e4-5c66-46cc-b7a1-6dc91c1cfa42@s41g2000prb.googlegroups.com> |
Followups directed to: comp.lang.c++
madamemandm@yahoo.com wrote:
> On Jun 16, 3:46 pm, "Alf P. Steinbach /Usenet" <alf.p.steinbach
> +use...@gmail.com> wrote:
>> * madamema...@yahoo.com, on 16.06.2011 22:10:
> [snip]
>> > On Jun 16, 11:51 am, "Alf P. Steinbach
>> > /Usenet"<alf.p.steinbach+use...@gmail.com> wrote:
>> >> The standard guarantees that when x is of integral type then
>> >> unsigned(x) is congruent to x modulo 2^n where n is the number of
>> >> value representation bits in `unsigned`. No, this isn't it a quote. I
>> >> just haven't had my coffee yet so not quite able to express things
>> >> more simply, sorry.
>>
>> > That is correct, and if you do the math under the conditions I
>> > described, you find that unsigned(INT_MIN) == 1.
>>
>> $3.9.1/3 requires the same value representation for a signed type as for
>> its corresponding unsigned type.
>
> n3092 says that they have the same object representation, not the same
> value representation.
> Which version are you getting yours from?
[...]
Actual standard [3.9.1/3]:
For each of the signed integer types, there exists a corresponding (but
different) unsigned integer type: "unsigned char", "unsigned short int",
"unsigned int", and "unsigned long int," each of which occupies the same
amount of storage and has the same alignment requirements (3.9) as the
corresponding signed integer type40) ; that is, each signed integer type
has the same object representation as its corresponding unsigned integer
type.
That is the sentence, you read. But read further in the same clause:
The range of nonnegative values of a signed integer type is a subrange of
the corresponding unsigned integer type, and the value representation of
each corresponding signed/unsigned type shall be the same.
In particularm note the "and the value representation ..." part.
In draft n3291 [3.9.1/3] you find the same:
For each of the standard signed integer types, there exists a
corresponding (but different) standard unsigned integer type: "unsigned
char", "unsigned short int", "unsigned int", "unsigned long int", and
"unsigned long long int", each of which occupies the same amount of
storage and has the same alignment requirements (3.11) as the
corresponding signed integer type45 ; that is, each signed integer type
has the same object representation as its corresponding unsigned integer
type. Likewise, for each of the extended signed integer types there exists
a corresponding extended unsigned integer type with the same amount of
storage and alignment requirements. The standard and extended unsigned
integer types are collectively called unsigned integer types. The range of
non-negative values of a signed integer type is a subrange of the
corresponding unsigned integer type, and
the value representation of each corresponding signed/unsigned type
shall be the same. [highlighting added]
The standard signed integer types and standard unsigned integer types are
collectively called the standard integer types, and the extended signed
integer types and extended unsigned integer types are collectively called
the extended integer types.
You might want to check n3092 again. Chances are, it also contains the
provision about the value representation.
Best,
Kai-Uwe Bux
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Slow -- VERY slow brain "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-16 01:08 +0200
Re: Slow -- VERY slow brain "Balog Pal" <pasa@lib.hu> - 2011-06-16 01:44 +0200
Re: Slow -- VERY slow brain Puppet_Sock <puppet_sock@hotmail.com> - 2011-06-16 06:25 -0700
Re: Slow -- VERY slow brain Noah Roberts <dont@email.me> - 2011-06-29 10:05 -0700
Re: Slow -- VERY slow brain Keith H Duggar <duggar@alum.mit.edu> - 2011-06-16 07:00 -0700
Re: Slow -- VERY slow brain "madamemandm@yahoo.com" <madamemandm@yahoo.com> - 2011-06-16 07:22 -0700
Re: Slow -- VERY slow brain "madamemandm@yahoo.com" <madamemandm@yahoo.com> - 2011-06-16 07:31 -0700
Re: Slow -- VERY slow brain "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-16 18:51 +0200
Re: Slow -- VERY slow brain "madamemandm@yahoo.com" <madamemandm@yahoo.com> - 2011-06-16 13:10 -0700
Re: Slow -- VERY slow brain "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-16 22:46 +0200
Re: Slow -- VERY slow brain "madamemandm@yahoo.com" <madamemandm@yahoo.com> - 2011-06-17 07:38 -0700
Re: Slow -- VERY slow brain Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-17 18:06 +0200
Re: Slow -- VERY slow brain "madamemandm@yahoo.com" <madamemandm@yahoo.com> - 2011-06-17 10:49 -0700
Re: Slow -- VERY slow brain "Paul" <pchristor@yahoo.co.uk> - 2011-06-17 18:27 +0100
Re: Slow -- VERY slow brain Werner <werasm@gmail.com> - 2011-06-17 01:33 -0700
Re: Slow -- VERY slow brain Öö Tiib <ootiib@hot.ee> - 2011-06-17 07:48 -0700
Re: Slow -- VERY slow brain Werner <werasm@gmail.com> - 2011-06-17 09:39 -0700
Re: Slow -- VERY slow brain "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-17 19:59 +0200
csiph-web