RootCint, C++ and initialization list for structs

Dear All,

hear is snipped of my code where I use initialization list to initialize static const array of structure:

tumsetup.h:

[code]struct DACset {
// DACset() {}
uint8_t backup_reg[46];
uint8_t backup_trim[129];

// ClassDef(DACset, 1)
};

class tumsetup /: public TObject/ {
public:
// …
static const DACset dacdef[portsnum];
ClassDef(tumsetup, 1)
};[/code]

and tumsetup.cpp:

const DACset tumsetup::dacdef[tumsetup:] = { // array level of init. { // struct level of init. { // array in struct level of init // data here; }, { // data here; } }, { { // data here; }, { // data here; } } };

While compiling like it is, I get error from g++ (caused by missing dictionary for struct):

[ 2%] Building CXX object CMakeFiles/TumSetup.dir/tumsetup.cpp.o [ 4%] Building CXX object CMakeFiles/TumSetup.dir/tumsetupDict.cxx.o /home/dziadu/src/tumsetup-0.6/tumsetupDict.cxx: In member function 'virtual void tumsetup::Streamer(TBuffer&)': /home/dziadu/src/tumsetup-0.6/tumsetupDict.cxx:128: error: 'struct DACset' has no member named 'Streamer' /home/dziadu/src/tumsetup-0.6/tumsetupDict.cxx:146: error: 'struct DACset' has no member named 'Streamer' make[2]: *** [CMakeFiles/TumSetup.dir/tumsetupDict.cxx.o] Error 1

When I uncomment ClassDef for this struct then error comes purely from g++:

[ 8%] Building CXX object CMakeFiles/TumSetup.dir/tumsetup.cpp.o /home/dziadu/src/tumsetup-0.6/tumsetup.cpp:110: error: could not convert '{{0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 255, 35, 6, 95, 87, 100, 137, 255, 69, 15, 54, 92, 69, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {8, 6, 2, 8, 9, 9, 7, 10, 7, 9, 6, 3, 10, 6, 0, 6, 7, 12, 9, 2, 7, 10, 5, 8, 6, 9, 6, 7, 10, 11, 4, 8, 11, 9, 7, 9, 5, 6, 10, 9, 6, 5, 9, 13, 9, 9, 8, 11, 4, 6, 5, 9, 8, 15, 5, 5, 8, 7, 9, 10, 5, 8, 8, 9, 11, 5, 6, 13, 7, 9, 7, 7, 12, 6, 10, 12, 15, 12, 4, 8, 6, 9, 10, 11, 10, 7, 11, 11, 8, 10, 11, 11, 10, 9, 10, 12, 6, 10, 9, 7, 9, 10, 9, 8, 8, 8, 8, 9, 11, 11, 9, 11, 12, 6, 8, 11, 10, 11, 13, 17, 9, 12, 7, 9, 12, 12, 12, 15, 0}}' to 'DACset' /home/dziadu/src/tumsetup-0.6/tumsetup.cpp:110: error: could not convert '{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 255, 35, 6, 95, 87, 100, 137, 255, 69, 15, 54, 92, 69, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}' to 'DACset' make[2]: *** [CMakeFiles/TumSetup.dir/tumsetup.cpp.o] Error 1

Problem obviously comes from that in not c++0x standard initialization list in C++ can by used only for POD objects (without any constructors and other object-oriented features). So my question is, is it somehow possible to avoid ROOT to creating/looking for dictionary for a member of the class? In my case it is ‘dacdef’.

Best,
Rafal

Hi,

you can surround it by
#ifndef CINT
// code to hide from CINT
#endif

Cheers, Axel.