C++程式中遇到Struct裡面包含Union時,更改為Delphi程式的問題 |
答題得分者是:syntax
|
decaview
一般會員 發表:3 回覆:1 積分:0 註冊:2004-01-16 發送簡訊給我 |
大家好:
小弟想要將一個C 程式更改為Delphi,其中遇到Struct中包含Union的問題,而此Union中又使用到其他Struct,編譯器給我的錯誤訊息為"rc_sig_msg_information_type needs initialization -not allowed in variant record",敢問各位能否給小弟一些寶貴的建議,謝謝大家,C 程式碼如下: typedef enum{ RC_SIG_MESSAGE = 0x0, L_SIG_MESSAGE, MAX_DMA_SIG_LOG_TYPE = 0xFF }dma_sig_log_type; typedef struct { uint8 hannel_type; uint8 rb_id; uint16 length; uint8 signalling_message[32]; }rc_sig_msg_information_type; typedef struct { uint8 nas_message_direction; uint32 nas_message_length; uint8 nas_message[32]; }l_sig_msg_information_type; typedef struct { cht_log_hdr_type hdr; dma_sig_log_type msg_type; union { rc_sig_msg_information_type rc_sig_msg; l_sig_msg_information_type l_sig_msg; }msg; }dma_sig_msg_information_type; 底下是小弟轉譯的Delphi程式,紅色部分就是出現問題的所在: type dma_sig_log_type = ( RC_SIG_MESSAGE = $00, L_SIG_MESSAGE, MAX_DMA_SIG_LOG_TYPE = $FF ); rc_sig_msg_information_type = record hannel_type: byte; rb_id: byte; length: uint16; signalling_message : array[1..32] of byte; end; l_sig_msg_information_type = record nas_message_direction: byte; nas_message_length: uint32; nas_message: array[1..32] of byte; end; dma_sig_msg_information_type = record hdr: cht_log_hdr_type; msg_type: dma_sig_log_type; case msg: integer of 1: (rc_sig_msg: rc_sig_msg_information_type); 2: (l_sig_msg: l_sig_msg_information_type); end; |
syntax
尊榮會員 發表:26 回覆:1139 積分:1258 註冊:2002-04-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |