Boost logo

Boost :

Subject: Re: [boost] [PATCH 1/2] Fixed warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)'
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-12-29 23:54:21


AMDG

On 12/21/2010 1:50 AM, Vasyl' wrote:
> diff --git a/boost/uuid/seed_rng.hpp b/boost/uuid/seed_rng.hpp
> index 3090197..4196536 100644
> --- a/boost/uuid/seed_rng.hpp
> +++ b/boost/uuid/seed_rng.hpp
> @@ -150,7 +150,8 @@ private:
>
> if(random_)
> {
> - std::fread( buffer, 1, 20, random_ );
> + size_t rnd_read_size = std::fread( buffer, 1,
> sizeof(buffer), random_ );
> + BOOST_ASSERT(rnd_read_size == sizeof(buffer));
> }
>
> // using an uninitialized buffer[] if fopen fails

If we're going to be picky about warnings at this
level, this will produce an unused variable warning
when asserts are disabled.

In Christ,
Steven Watanabe


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