I’ve downloaded recently the version Boost 1.34.1 and performed some tests on ours applications integrating Boost components.

 

During theses tests, I’ve tried to deserialize some XML archives generated w/ Boost 1.33.1 including some boost::optional<> instances and I’ve observed that the Visual C++ 7.1 IDE emits run-time checks in the load<boost::optional<>>()  @ line 60 in file boost/serialization/optional.hpp.

 

template<class Archive, class T>

void load(

    Archive & ar,

    boost::optional<T> & t,

    const unsigned int /*version*/

){

    bool tflag;

    ar >> boost::serialization::make_nvp("initialized", tflag);

    if (tflag){

        unsigned int v;

        if(3 < ar.get_library_version()){

            ar >> make_nvp("item_version", v);

        }

        detail::stack_construct<Archive, T> aux(ar, v);            

                   ^^^^^^^^^^^^^^^^^^^^^^^^

Here Run-Time Check Failure #3 - The variable 'v' is being used without being defined.

 

        ar >> boost::serialization::make_nvp("value", aux.reference());

        t.reset(aux.reference());

    }

    else {

        t.reset();

    }

}

 

Is it possible to avoid this run-time check by a preinitialisation of the local variable “v”? Is it a Bug?

 

Best regards,

 

Used Configurations:

Windows XP

         Boost 1.34.1 (through Boost Installer w/ DLL libraries)

 

Marc Viala