Ticket #4085: shut_off_gcc_warning_normal_distribution.diff

File shut_off_gcc_warning_normal_distribution.diff, 891 bytes (added by bluescarni@…, 13 years ago)

Proposed patch to initialise to zero the _r1, _r2 and _cached_rho data members of normal_distribution.hpp

  • boost/random/normal_distribution.hpp

    diff --git a/boost/random/normal_distribution.hpp b/boost/random/normal_distribution.hpp
    index 486411e..36acf0a 100644
    a b public:  
    3939
    4040  explicit normal_distribution(const result_type& mean_arg = result_type(0),
    4141                               const result_type& sigma_arg = result_type(1))
    42     : _mean(mean_arg), _sigma(sigma_arg), _valid(false)
     42    : _mean(mean_arg), _sigma(sigma_arg), _r1(0), _r2(0), _cached_rho(0), _valid(false)
    4343  {
    4444    assert(_sigma >= result_type(0));
    4545  }
    4646
    4747  // compiler-generated copy constructor is NOT fine, need to purge cache
    4848  normal_distribution(const normal_distribution& other)
    49     : _mean(other._mean), _sigma(other._sigma), _valid(false)
     49    : _mean(other._mean), _sigma(other._sigma), _r1(0), _r2(0), _cached_rho(0), _valid(false)
    5050  {
    5151  }
    5252