Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2006-05-23 07:31:43


John Reid wrote:
>
> I'm getting a runtime check error from MSVC8 in the following code
> checked out from cvs_head:
>
> serialization/collections_load_imp.hpp
> line 116
>
> ...
>
> template<class Archive, class Container, class InputFunction, class R>
> inline void load_collection(Archive & ar, Container &s)
> {
> s.clear();
> // retrieve number of elements
> unsigned int count;
> unsigned int item_version;
> ar >> BOOST_SERIALIZATION_NVP(count);
> if(3 < ar.get_library_version()){
> ar >> BOOST_SERIALIZATION_NVP(item_version);
> }
> R rx;
> rx(s, count);
> InputFunction ifunc;
> while(count-- > 0){
> ifunc(ar, s, item_version);
> }
> }
>
> ...
>
> The debugger breaks every time ifunc() is called which is frustrating to
> say the least.
>
> If load_collection() is wrapped with
>
> #pragma runtime_checks( "u", off )
> ...
> #pragma runtime_checks( "u", restore )
>
> it doesn't help - perhaps I've rebuilt it incorrectly, perhaps the
> pragma needs to be around where the code is instantiated. I managed to
> get around the problem by assigning 0 to item_version.

What happens when you break into the debugger. VC8 supports range
checked iterators, dereferencing an invalid iterator, etc.

What is the exception/assert message being generated?
Can you use the VC8 debugger and see what values each of the variables
are at the point where the assert/exception was generated?
Is there any information you can gather by looking up the callstack?

> Has anyone specifically chosen to turn runtime checks on for debug
> builds with MSVC8 or is this just the default?

VC8 has additional error checking when compiling for debug.

- Reece
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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