Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the use of CEREAL_CLASS_VERSION #813

Open
yydy1983 opened this issue Jan 12, 2024 · 1 comment
Open

About the use of CEREAL_CLASS_VERSION #813

yydy1983 opened this issue Jan 12, 2024 · 1 comment

Comments

@yydy1983
Copy link

There is no version in the data that has been serialized and saved. How can I read it in a program that has been upgraded with CEREAL_CLASS_VERSION?

@dimateos
Copy link

If you had no version argument in your serialize functions, Cereal did not store any versioning info.
So now you files are incompatible: Cereals tries to read versioning where there is none.

Data serialized without versioning cannot be loaded by a versioned serialization function (and vice versa). https://uscilab.github.io/cereal/serialization_functions.html

You could modify Cereal to store a version tag by default anyway or add some try catch afterwards...
This would increase complexity and impact performance.

Cereal, by design, ignores versioning data management completely when you dont need it.
If you suspect that you may need it later, you should add it from the start: at least the version argument so it will use the default version 0 for all classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants