Managing changes in memory-based data format

Posted by kamziro on Stack Overflow See other posts from Stack Overflow or by kamziro
Published on 2011-01-11T17:38:34Z Indexed on 2011/01/11 17:53 UTC
Read the original article Hit count: 225

Filed under:
|
|

So I've been using a compact data type in c++, and saving from memory or loading from the file involves just copying the bits of memory in and out.

However, the obvious drawback of this is that if you need to add/remove elements on the data, it becomes kind of messy. There's also problems with versioning, suppose you distribute a program which uses version A of the data, and then the next day you make version B of it, and then later on version C.

I suppose this can be solved by using something like xml or json. But suppose you can't do that for technical reasons.

What is the best way to do this, apart from having to make different if cases etc (which would be pretty ugly, I'd imagine)

© Stack Overflow or respective owner

Related posts about c++

Related posts about data-structures