|
Boost Users : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-10-26 12:37:21
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Deane Yang
> Sent: Thursday, October 26, 2006 9:34 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [boost.serialization] serialization crash
>
> RIVASSEAU Jean Noel wrote:
> > I've had the same problems. The problem is with the bool
> field. Code
> > restoring the archive crashes if the bool stored in the
> archive is not
> > equal to 0 or 1. But since you did not write a constructor
> in the Obj
> > class, the boolean will actually be initialized with
> anything( eg, read
> > 14675002 for example), and will be serialized that way in
> the archive
> > since it seems the serialization code does not check if the bool is
> > equal to 0 or 1 (only the restoration code).
> >
> > So, the solution is to initialize your boolean correctly
> and be very
> > careful whenever you use booleans. However, I think the
> Serialization
> > code should be fixed (remove the check for 0 or 1, it
> probably does
> > more bad than good.
> >
>
> In my (very) humble opinion, it should be at least symmetric.
> So either
> no check for 0 or 1 in both directions or a check for 0 or 1 in both
> directions.
>
> But it should also be consistent with other built-in types. Since it
> appears that there is no check (is one even possible?) for
> uninitialized
> data with other built-in types, I also vote for no check.
In any case, are booleans guaranteed to be 0 or 1 even if correctly
initialized?
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