有沒有辦法在C中創建多個枚舉的組合? 我想有一個共同的枚舉,將用於其他枚舉。枚舉的組合
例如,我想寫入以下代碼:
enum common_e {
COMMON_LITERAL_0,
COMMON_LITERAL_1
}
enum first_e {
common_e, // <- Somehow I would like to have the two common_e's literals here
FIRST_LITERAL_0,
}
enum another_e {
common_e, // <- Somehow I would like to have the two common_e's literals here
ANOTHER_LITERAL_0,
ANOTHER_LITERAL_1
}
我擔心的是保持共同文字在子enumarations相同的順序,因爲它們被用作ID爲函數指針陣列。
有沒有解決方案來做到這一點?
噢!你已經知道了,我認爲這就是我需要的。謝謝 – greydet 2011-05-03 22:37:16