Boost logo

Boost :

From: Arunava Saha (arunava_at_[hidden])
Date: 2008-01-02 13:11:33


Hi Robert,

  Let me be more precise on a particular behavior. This looks to me very
strange.

 

Suppose, I have a database. I serialized it to a file 1.txt in text
mode, deleted the current database, read back the file (1.txt) and
serialized again to another file 2.txt. Again, deleted the database,
read back 2.txt and serialized to yet another file 3.txt. Repeating the
same cycle I created another file 4.txt from the imported database of
3.txt.

 

Now if I compare these files, I see some interesting thing. 1.txt and
3.txt is identical. Similarly 2.txt and 4.txt is identical. But 1.txt
and 2.txt is NOT !!!!

 

Do you have any idea in which situation this can take place? If you need
any other information please get back to me. FYI, my database don't
contain any huge float or double values. There are mostly unsigned
integers, but a number of stl containers have been used throughout.

 

Thanks,

Arunava.

 

------------------------------------------------------------------------
------------------------------------

Date: Sun, 30 Dec 2007 08:52:46 -0800

From: "Robert Ramey" <ramey_at_[hidden]>

Subject: Re: [boost] A question regarding serialization lib

To: boost_at_[hidden]

Message-ID: <fl8ics$mdm$1_at_[hidden]>

 

Hmmmm - a very interesting question I've never considered.

 

All the serialization tests do the following: create a structure,
serialize to a file, load the file to a new structure and check for
equality.

 

I would expect that in your test text1.doc would be identical to
text2.doc.

 

UNLESS you have have floats/double in your classes. In general, it
cannot be guarenteed that there is a one-to-one correspondence between
floatiing point values as represented by binary in ram to text numbers
represented as decimal based text. So in this case I would expect
text1.doc to not be identical to text2.doc.

 

There may be other cases, but that's all that occurs to me right now.

 

Robert Ramey

 

 

 

Arunava Saha wrote:

> Dear experts,

>

> I am using boost serialization library to serialize a huge database

> (has a lot of stl containers, shared pointers etc. ). I have a general

> question regarding serialization lib of boost. Suppose I have

> serialized a database in text format (say, text1.doc), cleared the

> existing database, import the exported one back and re-export (say,

> text2.doc).

> Now, should I see any difference between text1.doc and text2.doc?

> Actually I am seeing some difference. If I shouldn't, can someone

> point me to the common mistakes one can do for which it differences

> can take place?

>

>

>

> Thanks in advance,

>

> Arunava.

>

> _______________________________________________

> Unsubscribe & other changes:

> http://lists.boost.org/mailman/listinfo.cgi/boost

 


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