| Thread overview | |||||
|---|---|---|---|---|---|
|
May 15, 2012 Array!bool and size_t | ||||
|---|---|---|---|---|
| ||||
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 | ||||
May 15, 2012 Re: Array!bool and size_t | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | 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. -- Dmitry Olshansky | |||
May 15, 2012 Re: Array!bool and size_t | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | 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
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply