Boost logo

Boost :

From: Thomas Klimpel (klimpel_at_[hidden])
Date: 2005-07-12 11:05:06


Hello,

 

The Boost Multi_Array library produces some 64-bit related warnings when
used with Visual C++.NET.

It seems to me that these warnings are valid and correspond to real
64-bit problems.

To get rid of these annoying warnings, I have fixed two minor
inconsistencies in multi_array/iterator.hpp and
multi_array/multi_array_ref.hpp, but that was not enough.

I also had to change the definition of boost::detail::multi_array::index
in multi_array/types.hpp from "typedef int index;" to "typedef
std::ptrdiff_t index;". There might be better solutions, but it was the
best I could think of, because std::ptrdiff_t is a signed type and will
adapt to a 64-bit environment.

 

 

 

 

Index: multi_array/iterator.hpp

===================================================================

--- multi_array/iterator.hpp (Revision 1040)

+++ multi_array/iterator.hpp (Arbeitskopie)

@@ -98,7 +98,7 @@

 

   array_iterator() {}

 

- array_iterator(int idx, TPtr base, const size_type* extents,

+ array_iterator(index idx, TPtr base, const size_type* extents,

                 const index* strides,

                 const index* index_base) :

     idx_(idx), base_(base), extents_(extents),

Index: multi_array/types.hpp

===================================================================

--- multi_array/types.hpp (Revision 1040)

+++ multi_array/types.hpp (Arbeitskopie)

@@ -26,7 +26,7 @@

 

 // needed typedefs

 typedef std::size_t size_type;

-typedef int index;

+typedef std::ptrdiff_t index;

 

 } // namespace multi_array

 } // namespace detail

Index: multi_array/multi_array_ref.hpp

===================================================================

--- multi_array/multi_array_ref.hpp (Revision 1040)

+++ multi_array/multi_array_ref.hpp (Arbeitskopie)

@@ -389,7 +389,7 @@

 

     // Calculate the array size

     num_elements_ =
std::accumulate(extent_list_.begin(),extent_list_.end(),

- 1,std::multiplies<index>());

+ size_type(1),std::multiplies<size_type>());

 #if 0

     assert(num_elements_ != 0);

 #endif

 

 

 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk