Array!bool and size_t

Nicolas Sicard dransic at gmail.com
Tue May 15 03:41:31 PDT 2012


On Tuesday, 15 May 2012 at 10:04:52 UTC, Dmitry Olshansky wrote:
> On 15.05.2012 13:44, Nicolas Sicard wrote:
>> The implementation of std.container.Array!bool makes use of 
>> ulong
>> instead of size_t as far as sizes and indices are concerned. 
>> This makes
>> Array!bool inconsistent with other array-like types (including 
>> Array!T
>> if !is(T==bool)) in 32-bit code. What would be the 
>> disadvantages of
>> using size_t?
>>
>> Thanks,
>> Nicolas
>>
> theoretically you can pack 8*2^30+ bits in 1Gb+ of memory. 
> While it's doubtful if you can always fetch such big piece of 
> contiguous memory from OS it's still possible. And 32bit 
> bit-indexes just fail to address it.

Yes, I understand this limitation. But from another theoretical 
point of view, length not returning a size_t is odd for a 
container (std.bitmanip.BitArray.length did).

But I am ok if it is more needful for an array of bool to be able 
to address the full memory...

Thanks,
Nicolas


More information about the Digitalmars-d mailing list