This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: ints in parallel code
- From: Johannes Singler <singler at kit dot edu>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 06 Nov 2009 12:21:49 +0100
- Subject: Re: ints in parallel code
- References: <4AF188F1.3040306@oracle.com> <4AF2C11E.5070004@oracle.com>
Paolo Carlini wrote:
> Paolo Carlini wrote:
>> today was going through the parallel code to do some more or less
>> formatting and uglifications fixes, when I noticed something potentially
>> much more serious: I'm seeing many plain ints around, also for things
>> which look like indexes in data, differences of iterators, things like
>> that.
> In particular, I wish you could double check the various ints used in
> the *multiway* functions, which seem all suspect to me.
All the ints in multiway*.h address sequences, i. e. the functions are
limited to about 2^31 sequences. The number of elements in these
sequences can be much higher.
In principle, you are right, the sequences are passed using iterators,
and their difference could be 64 bits. In practice, we are much further
away from having more than 2^31 sequences, than having more than 2^31
elements e. g. for sorting.
Anyway, do you want me to replace it with the appropriate
difference_type? It might have performance implications, though.
Johannes