yangyang128

@yangyang128

Joined on Feb 23, 2021

  • contributed by < xxiex123 > GitHub 環境 linux 5.8.0-59-generic $ lscpu Architecture: x86_64
     Like 1 Bookmark
  • contributed by < xxiex123 > 測驗一 解釋上述程式碼運作原理 list_head 的結構如同 quiz1 所述,它是一個通用的 doubly-linked list 結構,只要將他當作struct 裏的一個 member ,那他就能幫助該 struct 建立一個雙向鏈接。其能達到這樣的功能主要靠歸功于 container_of #ifndef container_of #define container_of(ptr, type, member) \ __extension__({ \ const __typeof__(((type *) 0)->member) *__pmember = (ptr); \
     Like  Bookmark
  • contributed by <xxiex123> 環境 Linux DESKTOP-KB3JHRC 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) 依照 C Programing Lab 的作業標準,額外添加實作queue sorting 的函數 q_new: 建立新的「空」佇列; q_free: 釋放佇列所佔用的記憶體;
     Like  Bookmark
  • contributed by < xxiex123 > 延伸問題1 解析以下code static inline void list_add_node_t(node_t **list, node_t *node_t) { node_t->next = *list; *list = node_t; }
     Like  Bookmark