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

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


2010/5/11 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Tue, May 11, 2010 at 5:07 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> I tend to agree that we need ptrdiff_t instead of int. I'd suggest:
>>
>> typedef std::ptrdiff_t idx;
>
> Please don't use 'idx'. :) How about idx_type or such... it should be
> more explicit.

How about idx_t ?

>> 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!
>
> I am still in favor of signed types because of the loop reasons.
> Similar things as Mark described happened to me too and I don't really
> see the advantages we gain by using unsigned types.

It's interesting to get this input from you, from Mark and from
Benjamin. So we all have quite the same experiencee: unsigned indexing
led to strange bugs for each of us. I was starting to wonder if I was
the only person to whom this happens...

Benoit

>
> There is another thing regarding OpenMP... IIRC, it does not like
> 'unsigned int's in for loops and will not parallelize those. But maybe
> it even does not like anything but 'int' -- I have to double check
> that. Though I agree that this is not a strong argument.
>
> Regards,
> Hauke
>
> p.s. I am wondering what the scenario of multiple 2GB vectors, not to
> say of matrices with multiple 2GB rows could be...
>
>
>



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