Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-09-22 03:51:34


Angus,

I see the problem again! Sorry to waste your time. I was testing with -DNEBUG.
For gcc to produce the warning -O2 is necessary.

> $ grep storage.hpp boost/numeric/ublas/CVS/Entries
> /storage.hpp/1.67/Mon Sep 12 19:18:12 2005//
>
> $ cat -n storage.hpp
> 120 BOOST_UBLAS_INLINE
> 121 void resize_internal (size_type size, value_type init, bool
> pres
> erve) {
> 122 if (size != size_) {
> 123 pointer data;
> 124 if (size) {
> 125 data = alloc_.allocate (size);
> 126 if (preserve) {
>
> It's line 123 that I think needs changing. Compiling only the program below
> with gcc 4.0.2 gives the warning. No warning is output with gcc 3.4.4.

I didn't like the idea of changing 123 to pointer 'data=0'. It gets rid of the
warning but the operation is not actually required!

The only efficient way to avoid the warning is to rewrite the function. Which
I have now done!

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________