0
我試圖以更易於管理的方式製作大塊數據。匿名結構,C99中的工會Keil MDK5
#pragma anon_unions
typedef union
{
uint8_t Contents[PACKET_SIZE];
struct
{
uint8_t Command;
uint8_t X[24];
uint8_t Y[24];
uint8_t Z[16];
uint8_t something;
.
.
.
};
struct
{
uint8_t Command; // have to rename to dummy_Command to avoid compiler error
uint8_t A;
uint8_t B[6];
uint8_t C[48];
.
.
.
};
} PacketToFromFile;
有沒有辦法仍然使用相同的名稱,如'命令'沒有任何編譯器錯誤?
它實際上比問題中的複雜得多。但是你的回答給了我解決這個問題的想法。有用。謝謝@SGeorgiades –
很高興我能幫上忙。也許是投票? – SGeorgiades