[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[csmith-dev] Using Generic sizeof() operator instead of hard quoted values for return values of datatypes

In the following code,

unsigned long Type::SizeInBytes(void) const
    size_t i;
        switch (eType) {
        default: break;
        case eSimple:
                switch (simple_type) {
                case eVoid:             return 0;
                case eInt:              return 4;
                case eShort:    return 2;
                case eChar:             return 1;
                case eLong:             return 4;
                case eLongLong: return 8;
                case eUChar:    return 1;
                case eUInt:             return 4;
                case eUShort:   return 2;
                case eULong:    return 4;
                case eULongLong:return 8;
                case eFloat:    return 4;
//              case eDouble:   return 8;

in {SOURCE CODE}/src/Types.cpp  of clone of Csmith's git repo,

returns hard quoted values of the sizes of the data types which could
differ for various architectures.

Is it ok to change it to return  sizeof(DATA TYPE)?

This is what I found on internet about using generalized structure,

Sameeran Joshi.