Signed word lengths and indexes

bearophile bearophileHUGS at lycos.com
Wed Jun 16 04:29:31 PDT 2010


Walter Bright:

>Changing the sign of size_t from unsigned to signed when going from 32 to 64 bits will cause a difference in behavior.<

I have proposed to use a "signed word" on both 32 and 64 bits systems. So where's the difference in behaviour?


>A memory manager sees the address space as 0..N, not -N/2..0..N/2<

If D arrays use signed words as indexes on 32 bit systems then only half of the original length can be used. The numbers in 0..N/2 are a subset of half of the unsigned number range.

Bye,
bearophile


More information about the Digitalmars-d mailing list