lion03 / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

thrust::sequence() generates a lengthy warning on msvc #245

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reported by Konstantin Kolchin on thrust-users [1]

The following code
 const int N = 6;
 thrust::device_vector<int> values(N) ;
 thrust::sequence(values.begin(), values.end());

Produces warning C4244 (see below).

C:\CUDA\include\thrust/iterator/detail/counting_iterator.inl(144) :
warning C4244: 'return' : conversion from '__int64' to 'int', possible
loss of data
        C:\CUDA\include\thrust/iterator/detail/counting_iterator.inl(143)
: while compiling class template member function 'int
thrust::detail::number_distance<Difference,Incrementable1,Incrementable2>::dista
nce(Incrementable1,Incrementable2)'
        with
        [
            Difference=int,
            Incrementable1=int,
            Incrementable2=int
        ]

[1] 
http://groups.google.com/group/thrust-users/browse_thread/thread/f9adb47c595de08
a#

Original issue reported on code.google.com by wnbell on 7 Oct 2010 at 7:10

GoogleCodeExporter commented 8 years ago
Best solution is probably to use OutputType instead of difference_type in the 
counting_iterator here:
http://code.google.com/p/thrust/source/browse/thrust/detail/sequence.inl#82

Original comment by wnbell on 7 Oct 2010 at 7:23

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 7c5e92c72a.

Original comment by wnbell on 7 Oct 2010 at 8:41