@karim That's a good question. The answer could be found in the TDocStd_FormatVersion.hxx header file, where we read the following:
...
By default, Open CASCADE Technology writes new documents using the last file format version.
The last version of Open CASCADE Technology is able to read old documents of any version.
However, a previous version of Open CASCADE Technology may not be able to read a new document.
In this case use the method ChangeStorageFormatVersion() from TDocStd_Document to change the file format version.
Then, save the document by means of SaveAs() from TDocStd_Application.
...
The version is incremented each time there's any change in storage/retrieval drivers of some OCAF attributes. Indeed, if you try to load a binary/XML file stored by the newer version of OpenCascade with the older version of the library, that's not going to work. Therefore, there's no forward compatibility, and that's kind of expected for a normal (not very advanced, so to speak) system.
In C++, the storage format can be accessed via
TDocStd_Document::CurrentStorageFormatVersion()
method called on an OCAF document. If you look deeper into the sources, you will find out that this method is called from within
BinLDrivers
and
XmlLDrivers
packages that are responsible for serialization/deserialization of OCAF documents.
So make sure to use the newer version of OpenCascade to read the older binary files. Backward compatibility will work.