看板 EE_DSnP 關於我們 聯絡資訊
試試cdecl 或 c++decl. 進入之後使用explain,可以得到下列答案: ※ 引述《danielko (蛋尼爾糕)》之銘言: : 1. int(*a)(int) 是什麼意思 cdecl> explain int(*a)(int) declare a as pointer to function (int) returning int : 2. int(*a[10])(int) 是什麼意思 cdecl> explain int(*a[10])(int) declare a as array 10 of pointer to function (int) returning int : 3. int(*a)[10] 跟 int*a[10] 一樣嗎 cdecl> explain int(*a)[10] declare a as pointer to array 10 of int cdecl> explain int*a[10] declare a as array 10 of pointer to int : (我對後者的認知是宣告一個大小10的array,裡面裝的都是int*) : 感謝:) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.20.226
danielko:那兩個是要另外安裝的軟體嗎?? 05/30 17:11
ric2k1:ccws 好像沒裝, 231 有. 有人可以向 PC室助教反應一下嗎? 05/30 17:17
ric2k1: 看饒神的文章長知識! 05/30 17:17
kalawang:真的是看饒神文章長知識!!! 05/30 17:20
danielko:BTW 這些用法是過時的用法嗎 還是只是我太嫩了沒看過? 05/30 22:24
timrau:在C裡面只得這樣寫 在C++裡通常想辦法用functor代替 05/30 22:26
timrau:不過像是第二項 可以用來把某些要花linear time的switch 05/30 22:28
timrau:壓成constant time的操作 05/30 22:28
bnsblue:可以請饒神開示一下上面這兩句是什麼意思嗎XD 05/31 00:33
timrau:想像一下用暴力switch和用polymorphism寫CmdParser的差異吧 05/31 00:46
timrau:virtual function所用的機制 其實就是這樣 05/31 00:47
timrau:switch雖然在理想狀況下也能做到constant time dispatching 05/31 00:47
timrau:但是compiler常常處理不了這動作,只能弄得很像多個if 05/31 00:48
timrau:然後就變linear time了 05/31 00:48
bnsblue:太厲害了! 05/31 11:25