Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-12-02 11:42:01


----- Mensaje original -----
De: Oleg Abrosimov <olegabr_at_[hidden]>
Fecha: Sábado, Diciembre 2, 2006 5:21 pm
Asunto: Re: [boost] [pool] Warnings in MSVC 7.1 and 8.0
Para: boost_at_[hidden]

> JOAQUIN LOPEZ MU?Z wrote:
> >
> > Oleg, looks like Harmut Kaiser has already fixed this
> > problem in the CVS version of pool.hpp. Would you mind
> > downloading this newer version from
> >
> >
>
http://boost.cvs.sourceforge.net/*checkout*/boost/boost/boost/pool/pool>
 .hpp?revision=1.15
> >
> > and reporting whether the warnings you had go away?
>
> I've examined it and found the following code snippet:
>
> template <typename UserAllocator>
> void * pool<UserAllocator>::ordered_malloc(const size_type n)
> {
> const size_type partition_size = alloc_size();
> const size_type total_req_size = n * requested_size;
> const size_type num_chunks = total_req_size / partition_size +
> static_cast<bool>(total_req_size % partition_size);
>
>
> It suggests that warnings would persist.

Better than guessing, please try this version on your local
environment: do warnings still show up? After all, the change was
labeled by Harmut like "Removed VC7.1 warning 4800", so
it's reasonable to explicitly verify whether they make a
difference.

>
> The problem is that this lines are copy-pasted in three different
> places and it is a maintainability issue that Harmut Kaiser was
> catched by.
>
> Second, he replaced this code in two other places by the following:
>
> const size_type partition_size = alloc_size();
> const size_type total_req_size = n * requested_size;
> const size_type num_chunks = total_req_size /
> partition_size +
> ((total_req_size % partition_size) ? true : false);
>
>
> I failed to see how it is better then original version, because
> the
> problem is in implicit conversion from bool to integer type during
> promotion in operator+

As I said above, there must be a reason for Harmut to have committed
such changes, only actually trying this version will tell for sure.

Let's do the following: please try v1.15 of pool.hpp on your
local environment and check if the warnings persist or not: if the
former, please post a .diff between v1.15 and your proposed
modification and I can see that it makes it to the CVS next
Monday. How does this look yo you?

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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