我发现了这么奇怪的东西:对于 MasterBootRecord 结构
//
typedef unsigned char Byte;
typedef unsigned short int Word;
typedef unsigned int Dword;
//
typedef struct
{
Byte currentPartitionState;
Byte startPartitionHead;
Word startCylinderSector;
Byte partitionType;
Byte endPartitionHead;
Word endCylinderSector;
Dword numSectorsBetweenMbrAndPartition;
Dword numSectorsInPartition;
} PartitionEntry;
//
typedef struct
{
Byte executableCode[446];
PartitionEntry partitionEntry1;
PartitionEntry partitionEntry2;
PartitionEntry partitionEntry3;
PartitionEntry partitionEntry4;
Word bootRecordSignature;
} MasterBootRecord;
当我尝试获取 sizeof(MasterBootRecord) 时,我得到了 516 个字节,虽然正确的大小是 446 + 4*16 + 2 = 512。为什么会这样???