Boost logo

Boost Users :

From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2005-11-11 05:12:23


Ian McCulloch wrote:
> I don't really have an opinion here, but why is it the job of the
> serialization library to attempt to detect completely unrelated programmer
> errors?

My concern is that the library can write out something it cannot read
back in... this conflicts with its most obvious use, taking an object,
writing it to disc, reading it back in, exactly as it was before
writing to disc (assuming same machine reading writing, ignoring
memory locations for pointers etc).

I think in the case reported by Paul, he's not necessarily using the
unitialised value, as its an object that is kind of like a
discriminated union. I think this usage parallels the idea of NaN's
etc in floating point. I'd expect these to be read back in too, as you
suggested.

However, having a debug flag separate from NDEBUG, that puts in
stricter checks at the expense of speed of serialisation is a good
idea IMO. This should be orthoganal to the serialisation of a
bool/float/whatever.

Kevin

-- 
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this      |
| Senior Technology                     | My employer for certain |
| And Network Systems Architect         | Not even myself         |

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net