Increase class version number when changing enum?

Hi all,

I have a class with a public enum member e.g.

Class MAnalysisProblems : public MParContainer
{

private: ...
....

public:

enum InitializationType_t {

... different enum members ...
}

ClassDef(MAnalysisProblems , 6)

};

My question is: if I add a member in the enum above, should I increase the class version number? Intuitively I would say no, but I am not sure.

Best regards,
Alessio


ROOT Version: 6.28
Platform: Linux 22.04
Compiler: gcc 11.3.0


Hi @sharingan,

Recently, we briefly discussed enum schema evolution in the regular ROOT I/O meeting (FYI: @pcanal @jblomer).

My guess here (although @pcanal may prove me wrong), is that the class version number should be incremented if there is at least one data member whose type is enum InitializationType_t.

Cheers,
J.

Thanks for the reply! So, shall I wait for @pcanal or may I simply go for the increased class version number?

Alessio

Hi,

Probably the safest thing is to increment the class version number, but for a final verdict, I would wait for @pcanal’s recommendation.

Cheers,
J.

You don’t need to increment the class version number if you add a constant to the enum.

Enums are serialized as their underlying integer types, so wrt. to the class layout there are no changes. If, however, you need at some point to swap constants or change their value, you’d need to add an I/O customization rule for manual schema evolution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.