為什麼這篇tobias意思鄉民發文收入到精華區:因為在tobias意思這個討論話題中,有許多相關的文章在討論,這篇最有參考價值!作者zzss2003 (brotherD)看板C_and_CPP標題[問題] 請教關於Axel-To...
tobias意思 在 Chris電影宇宙?? Instagram 的最佳解答
2021-02-03 08:23:30
2020年最喜愛電影 第1️⃣1️⃣位 #醉好的時光 #AnotherRound #Druk · 導演Thomas Vinterberg繼筆者極喜歡嘅2012年電影《誣網》後再一次與男星Mads Mikkelsen合作,聽到呢個組合已經冇錯過呢部作品嘅理由,未睇之前更已經鎖定呢套戲會成為筆者年度最喜...
小弟最近在拜讀Axel-Tobias Schreiner的Object-oriented Programming in ANSI-C,
殊不知看不太懂作者想要表達的想法與觀念,故想上網請教前輩們。
附上pdf網址:https://www.cs.rit.edu/~ats/books/ooc.pdf
在PDF第7頁,"Alternatively, we can define a data type as a set of values plus
operations to work with them."
data type可以定義為一組數值+上與數值的運算,不太懂這句話想要表達的含意是什麼(註
:我只會C,不會C++)
對我來說data type就是最基本的int, char,double與float,其餘像是array, struct,
union都是最基本的延伸的變化型。
接著在下列的這句話"Typically, the values are what a computer can represent, and
the operations more or less reflect the available hardware instructions. int in
ANSI-C does not do too well in this respect: the set of values may vary between
machines, and operations like arithmetic right shift may behave differently."
第二句看不懂,operation體現出可使用的硬體指令?為什麼ANSI-C的int在這方面做得不太
好?是哪方面?
接著,"More complicated examples do not fare much better. Typically we would
define an element of a linear list as a structure"
作者說明更複雜的data type進展的也不是很好,並舉例了一個例子:
typedef struct node {
struct node * next;
... information ...
} node;
and for the operations we specify function headers like
node * head (node * elt, const node * tail);
作者說明,這個方法相當馬虎,好的原則應該是要隱藏data item的representation且只
declare possible manipulations.
問題1: 什麼是 linear list? 為什麼這個struct是linear list的一種?
問題2: head應該是指向一個函式的指標吧?
問題3: 所以operation不是指+ - * /這類的?
問題4: 這個例子的representation of data item是那些東西?
問題5: only declare possible manipulation是指什麼意思?
問題6: 為什麼這個方法會相當馬虎? 哪邊馬虎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.26.157
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1502782305.A.C87.html
※ 編輯: zzss2003 (60.248.26.157), 08/15/2017 15:40:46
※ 編輯: zzss2003 (60.248.26.157), 08/15/2017 16:54:59
※ 編輯: zzss2003 (60.248.26.157), 08/18/2017 13:11:25