I’ve inherited a boatload of ROOT5 code I’d like to make run under both ROOT5 and ROOT6.
It is full of
ROOT::Cintex::Cintex::Enable();
and putting macros around that line is getting really old after about 30 times.
Any simple suggestions for overriding that code which crops up everywhere.
Hi,
how about doing a find/replace of ROOT::Cintex::Cintex::Enable()
in all files with
#include <enablecintex.h>
EnableCintex();
and then implement EnableCintex
only once, and putting an #ifdef
inside the body that makes it no-op for ROOT6?
Or equivalently, implementing
#if IS_ROOT_6
namespace ROOT {
namespace Cintex {
namespace Cintex {
void Enable() {}
}
}
}
#endif
Cheers,
Enrico
Thanks that seems to work.
Is IS_ROOT_6 a variable I can expect to exist or do I need to set it myself someplace.
but aside from that question I think I can now do much less damage to existing code.
Try to “#include” anything from ROOT and then (if ROOT 5 will misbehave, replace ROOT_VERSION(6,00,00)
with 393216
):
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00)
// ... ROOT 6.00/00 and newer
#else /* ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00) */
// ... ROOT 5 (and older)
#endif /* ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00) */
See also:
1 Like