I have a global include file which contains a set of structures. Somewhere in my program, I have a class that contains a member array. The number of elements in this array is dependent on the size of a specific field in a specific struct. I want to make it so that the array size will get automatically updated if the sizeof the structure field is changed. I have been able to do this succesfully with the following expression:
bool shadowChkBox[sizeof(FSCconfigType::WriteEn)*8*MAX_FSCS];
FSCconfigType is the struct type and WriteEn is one of the fields. Now this worked but only on ubuntu. On RHEL 5, the compiler declared it as an error. What other alternatives could I have for doing this? I am working with Qt.