p***@hotmail.com
2006-06-28 14:00:09 UTC
I'm having some trouble with the MIPSPro compiler, version 7.4.2m, on
an Octane MXE. I've posted a condensed code sample that shows my
problem. On every other compiler, sizeof(Test<unsigned char, float> is
(correctly) 3. On MIPSPro, it's 5! Basically it adds one for every
empty base class that Test inherits from. I can understand that
TestRGBBase can't have size 0, but it shouldn't affect the size of the
derived class should it?
Is this a known bug?
Is 7.4.2m the latest version of the compiler, and if not, where can I
get the latest?
#include <string>
class TestRGBBase {
public :
static const int testBase = 0;
};
class TestRGBBase2 {
public :
static const int testBase2 = 0;
};
template<class VALUETYPE, class ARITHMETICTYPE>
class Test : public TestRGBBase, public TestRGBBase2 {
public :
typedef VALUETYPE ValueType;
typedef ARITHMETICTYPE ArithmeticType;
VALUETYPE r, g, b;
};
int main(int argc, char *argv[])
{
Test<unsigned char, float> a;
TestRGBBase b;
TestRGBBase2 c;
printf("Size of Test is %d\n", sizeof(a));
printf("Size of TestRGBBase is %d\n", sizeof(b));
printf("Size of TestRGBBase2 is %d\n", sizeof(c));
}
an Octane MXE. I've posted a condensed code sample that shows my
problem. On every other compiler, sizeof(Test<unsigned char, float> is
(correctly) 3. On MIPSPro, it's 5! Basically it adds one for every
empty base class that Test inherits from. I can understand that
TestRGBBase can't have size 0, but it shouldn't affect the size of the
derived class should it?
Is this a known bug?
Is 7.4.2m the latest version of the compiler, and if not, where can I
get the latest?
#include <string>
class TestRGBBase {
public :
static const int testBase = 0;
};
class TestRGBBase2 {
public :
static const int testBase2 = 0;
};
template<class VALUETYPE, class ARITHMETICTYPE>
class Test : public TestRGBBase, public TestRGBBase2 {
public :
typedef VALUETYPE ValueType;
typedef ARITHMETICTYPE ArithmeticType;
VALUETYPE r, g, b;
};
int main(int argc, char *argv[])
{
Test<unsigned char, float> a;
TestRGBBase b;
TestRGBBase2 c;
printf("Size of Test is %d\n", sizeof(a));
printf("Size of TestRGBBase is %d\n", sizeof(b));
printf("Size of TestRGBBase2 is %d\n", sizeof(c));
}