|
Boost : |
From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2004-05-08 11:48:29
Hi,
The switch-case in class archive_exception lacks a 'break' after the 'stream
error' case
which leads to incorrect what() message.
I also note that the error code "invalid_class_name" doesn't have a message
equivalent.
Furthermore I'm confused about this (which was the reason I found the other
bug) :
(VC7.1 + Dinkumware)
int main()
{
try
{
// save
{
std::ofstream ofs("serializer_test.txt");
boost::archive::text_oarchive oa(ofs);
oa << 'x';
// ofs.close(); // uncommenting this throws "stream_error" (altough
currently with wrong what() message)
oa << 'y';
}
// load
{
std::ifstream ifs("serializer_test.txt", std::ios::binary);
boost::archive::text_iarchive ia(ifs);
char x, y;
ia >> x;
// ifs.close(); // uncommenting this _doesn't_ throw?
ia >> y;
assert(x == 'x' && y == 'y');
}
}
catch(std::exception const& e)
{
std::cout << e.what();
}
return 0;
}
Shouldn't reading throw also? The archives check is/os.good() to throw.
Or is this a bug in my std.lib (or my understanding of it? ;)
// Fredrik Blomqvist
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk