
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. 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+ Just replace true with 1 and false with 0 and add an explicit !=0 test and you'll have what I've originally proposed: size_type calc_num_chunks(const size_type n) { const size_type partition_size = alloc_size(); const size_type total_req_size = n * requested_size; return total_req_size / partition_size + (total_req_size % partition_size) != 0 ? 1 : 0; } Best, Oleg Abrosimov