Re: [eigen] Indexes: why signed instead of unsigned?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


That sounds like a solution.

As for the signed/unsigned thing - having been bitten by a few buggy
unsigned uses in loops I'd favor signed.
Using unsigned gives you 2x larger maximal size, but if size is a
problem, 64bit integers should be used anyway which seems to be the plan
now (on 64bit systems)

Without the size argument, I don't see any reason favoring unsigned
given the bugs it can produce. I find the 'it feels natural' argument
quite unconvincing.

Just my two cents
Benjamin



On 05/11/2010 05:07 PM, Benoit Jacob wrote:
> I tend to agree that we need ptrdiff_t instead of int. I'd suggest:
> 
> typedef std::ptrdiff_t idx;
> 
> so we get something short to type.
> 
> There remains the question of signed vs. unsigned. In other words,
> ptrdiff_t vs. size_t. I'm totally unable to decide either way. Help!
> 
> Benoit
> 
> 2010/5/11 joel falcou <joel.falcou@xxxxxx>:
>> Rohit Garg wrote:
>>>
>>> This will become an issue when people start using bigger datasets than
>>> 2GB. At a minimum, we need a eigen_size_t typedef somewhere for easy
>>> portability. Using long throughout in 32 bit machines doesn't make
>>> sense.
>>>
>>
>> Isn't it what ptrdiff_t supposed to be ? biggest signed int on the platform
>> .
>>
>> --
>> ___________________________________________
>> Joel Falcou - Assistant Professor
>> PARALL Team - LRI - Universite Paris Sud XI
>> Tel : (+33)1 69 15 66 35
>>
>>
>>
>>
>>
> 
> 




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/