Arm“#pragma anon_unions”允许:
typedef struct {
uint32_t sensorID;
uint8_t messageHeader;
uint8_t messageID;
uint16_t payloadLength;
} Header;
typedef struct {
uint8_t startOfPacket[SERIAL_SOP_SIZE];
Header; // Anonymous.
uint8_t payload[SIZE];
} Packet;
Packet packet;
packet.messageID = 1; // Referencing member of Header through a Packet.
关于在 VisualStudio 中编译此代码的任何想法?