关于TBool的问题,为什么要使用TBool
Symbian的基础是C++,C++中的布尔型用bool,用1个字节
为什么在内存紧缺的Symbian开发时,一般使用TBool呢
TBool是4字节的Int型,占用内存比较大,我是这么认为的
[解决办法]
举个例子:
struct M { bool iFlag; // offset 0, 1 byte bool iFlag2; // offset 1, 1 byte TInt32 iInteger; // offset 4, 4 bytes };
[解决办法]
struct M
{
bool iFlag;
TInt32 iInteger;
bool iFlag2;
};
sizeof(M)==12
建议用TBool