Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-12-27 05:31:41


Victor A. Wagner Jr. wrote:
>At 11:59 2005-12-24, simon meiklejohn wrote:
> >running a debug build of one of your examples in
> >vc8.0 (visual studio beta 2) asserts "list iterators incompatible"
> >from a calling location in hash_map.hpp
> >// Insert a new entry into the map.
> >std::pair<iterator, bool> insert(const value_type& v)
> >{
> > size_t bucket = boost::hash_value(v.first) % num_buckets;
> > iterator it = buckets_[bucket].first;
> > if (it == values_.end() ) <--- asserts
> >
> >Probably just "Safe" C++ library getting in the way. Anyone
> >know a way to disable this checking?

This is different to the "safe" C and C++ libraries.

>you may be pleased to know that with the
>"release" vs2005 there is no assert (debug), but
>I'm concerned about the program itself.

Assertions are not compiled in release builds. In the new VS2005 standard
library, there are assertion checks to validate various things such as:
* checking that two iterators being compared are from the same container;
* checking that an iterator hasn't gone past the end of the container.

It may be interesting to see if the following asserts (bug in the runtime
library):
   iterator first = c.begin(), last = c.end();
   if( first == last ) // does this assert?
   {
   }

However, this most likely indicates a bug in that code.

>I get different outputs from release and debug

>ok, this intrigued me some....so I put
>breakpoints before the output of "Successful........" and looked at buf_
>when in release, there was a '\0' after the
>"hello there", in debug, there wasn't.
>I then looked up readsome for I/O streams in
>"The C++ Standard Library" Nicolai Josuttis... his documentation says
>readsome() returns a std::streamsize (so you know
>how many characters are actually in the biffer)
>AND explicitly says there will be NO '\0' put into the buffer.

So is the I/O stream implementation inserting a '\0' in the release build as
part of their "safe" runtime library initiative? Or is this in Johnathan's
I/O streams library?

- Reece


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