[問題] __packed type 傳遞問題
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
Keil C
問題(Question):
我想要宣告一塊連續記憶體, 利用__packed包住讓兩個陣列中間沒有padding.
但當要對這塊記憶體存取時, 或傳遞到 void* 變數時, 會發生error.
請問這個有法解決嗎? thanks
錯誤結果(Wrong Output):
Error: argument of type "__packed int16_t *" is incompatible with
parameter of type "void *"
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
http://pastie.org/p/6IyFOaduXr98h7CzkumZeB
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.125.153.170 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1617880237.A.CDA.html
推
04/08 22:23,
3年前
, 1F
04/08 22:23, 1F
→
04/08 22:23,
3年前
, 2F
04/08 22:23, 2F
→
04/08 22:27,
3年前
, 3F
04/08 22:27, 3F
但同時也需要兼容於 非__packed() 的
※ 編輯: eleghost (122.117.14.246 臺灣), 04/08/2021 22:37:07
→
04/08 22:42,
3年前
, 4F
04/08 22:42, 4F
→
04/08 22:42,
3年前
, 5F
04/08 22:42, 5F
→
04/08 22:42,
3年前
, 6F
04/08 22:42, 6F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章