Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-08-19 06:59:15


Hello,

I get a compiler warning in unbounded_array::resize_internal(...):

boost/numeric/ublas/storage.hpp: In Memberfunktion »void
   boost::numeric::ublas::unbounded_array<T, ALLOC>::resize_internal(typename
   ALLOC::size_type, T, bool) [with T = int, ALLOC = std::allocator<int>]«:
boost/numeric/ublas/storage.hpp:110: Warnung: `int*data'
   might be used uninitialized in this function

We should change line 110
             pointer data = 0;

otherwise data_ will have random content if the new size is zero.
(Alternatively we can add an else clause to "if (size) { ... }" )

mfg
Gunter

---8x----------------------

Index: storage.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/numeric/ublas/storage.hpp,v
retrieving revision 1.65
diff -u -p -r1.65 storage.hpp
--- storage.hpp 16 Aug 2005 18:07:21 -0000 1.65
+++ storage.hpp 19 Aug 2005 11:55:04 -0000
@@ -107,7 +107,7 @@ namespace boost { namespace numeric { na
         BOOST_UBLAS_INLINE
         void resize_internal (size_type size, value_type init, bool preserve)
{
             if (size != size_) {
- pointer data;
+ pointer data = 0;
                 if (size) {
                     data = alloc_.allocate (size);
                     if (preserve) {