C++ 结构体字节占比分配

struct Param
{
	unsigned long A : 8;
	unsigned long B : 24;

	Param()
	{
		memset(this, 0, sizeof(Param));
	}
};


Param param;
param.A = 0xffffffff;
param.B = 0xffffffff;

//A为0x000000ff
//B为0x00ffffff

你可能感兴趣的:(C++)