ClassDef / ClassImp

Hi Bertrand,
when will we get rid of ClassDefs/ClassImps?

ClassImp are not needed anymore

ClassDefs (or inheritance from TObject) are not needed either for the I/O of custom classes, you only need to generate the corresponding dictionaries.

I’ve moved this to a new topic; not immediately obvious what this has to do with clang-repl.

As @eguiraud points out, ClassImp is not needed since many many years. ClassDef is required for classes inheriting from TObject, and an optional I/O optimization for another classes.

The manual has been updated.

…but it’s still wrong/misleading as it implies that inheritance from TObject is mandatory

Bring "how to use my class with ROOT" up to date. by Axel-Naumann · Pull Request #611 · root-project/web · GitHub might help.

Hi @couet ,
sorry for small “oftopic comment”:

  1. the linked page suggests that ClassImp is mandatory and later… you write about ClassDef, also in example you added a comment that ClassImp is for I/O and RTTI
  2. it will be nice to explain what “default values” mean for pointers pointers. As far as I know in some part of “ROOT user’s guide” it’s written that in principle all pointers should be initialized in default constructor as nullptr,

My change addresses your point 1 already. I’ll add the nullptr initialization, good point!

Good points. Fixed by Remove ClassImp references by couet · Pull Request #612 · root-project/web · GitHub

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