Sorry if this has been explained already or sounds like a newbie question. But I do have a question regarding ClassDef versioning which I have been asked a few times but never had a real answer and also could not find clear documentation.
You will need to increase the version number whenever you change the definition of your class
but assuming I have
class A {
// ...
ClassDef(A, 1);
};
class B {
// ...
A a;
ClassDef(B, 1);
};
class C: public A {
// ...
ClassDef(C, 1);
};
and I change the definition of A and increase the ClassDef version for A, do I also need to increment the versions for classes B and C? Technically I didn’t modify the definition of B or C but the memory layout might change.
Is there a clear answer?
ROOT Version: 6.14 Platform: Linux Compiler: GCC 8.2
For the I/O, base classes are similar to special data members. As such, only changes of the immediate members count, not transitive changes. No need to increase the ClassDef version if members in bases change (your case C), or member in types of members (your case B). We take care of the rest!
(And note that the use of ClassDef is a performance optimization; ROOT can do I/O just fine without. The only exception is classes inheriting from TObject which generally require the use of ClassDef.)