Boost logo

Boost :

From: jk_at_[hidden]
Date: 2001-08-27 23:39:42


27 Aug 2001 17:31:39 +0400 scleary_at_[hidden] wrote:
>> As it is specified in comments in
>> boost/pool/simple_segregated_storage.hpp,
>> function
>>
>> boost::simple_segregated_storage::malloc_n
>>
>> should meet a precondition "!empty()". Putting this condition
>> in a body
>> of function as "assert (!empty()) " at once shows that it is
>> not observed. Not
>> clear, why boost::pool author has not made it himself. The
>> test example built
>> with g++ 2.95.3, without this "assert" is silently running,
>> as if there is no
>> errors. However when I tried STLport 4.1b6 (and any later
>> version) then
>> immediate segmentation fault was occured.
>>
>> Is it some kind of my fault, or real bug in boost::pool?
>
>This is a documentation error. That precondition is not actually required
>for that function. Thanks for finding it -- I'll fix it.

These comments still very helpful, but why didn't you put the preconditions
and postconditions directly into assert's, at least some of them? Everyone
knows how to turn asserts off.

>The segementation fault is another problem. I know that STLport, at least
>as of ver 4.0, has a bug in its usage of allocators, so if you look in the

Do you mean deallocate(NULL)? If so, I can see that it is STLport bug.

>beginning of 'pool_alloc.hpp', you'll see I define:
> #define BOOST_POOL_ALLOC_ALLOW_NULL_DEALLOCATE
>for __SGI_STL_PORT <= 0x400. I suspect that if you define this, it will
>work.

Yes, it works.

Thank you for your explanation. I didn't investigate source code too deeply,
because of mentioned (false) precondition. But now STLport defines another
version macro.

May I forward your answer into STLport forum, if you don't want to report the
bug yourself? There is now release candidate of STLport 4.1, and the bug is
still there.

-- 
jk

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