### c++ | Hide Function Pointer Declarations With a typedef 用 typedef 來隱藏極為繁複的函式指標宣告形式

 http://blog.xuite.net/jackie.xie/bluelove/12822840?ref=relHide Function Pointer Declarations With a typedef用 typedef 來隱藏極為繁複的函式指標宣告形式 Can you tell what the following declaration means? 你可以說出下列宣告是何含意嗎? void (*p[10]) (void (*)() );  Only few programmers can tell that p is an "array of 10 pointers to a function returning void and taking a pointer to another function that returns void and takes no arguments." The cumbersome syntax is nearly indecipherable. However, you can simplify it considerably by using typedef declarations. First, declare a typedef for "pointer to a function returning void and taking no arguments" as follows: 僅有少數的程式設計者可以闡明這個宣告的意義: 亦即 "p 是一個元素大小為10且指向並返回一個無型態的函式的指標陣列;其內的形式參數,是為帶有一個指向其他函式並返回無型態的指標之函式,且此函式並無任何形式參數."  typedef void (*pfv)();  Next, declare another typedef for "pointer to a function returning void and taking a pfv" based on the typedef we previously declared: 其次,基於我們先前的型態定義的宣告方式, 而對 "指向一個返回無型態的函式且其內帶有 pfv" 來作為宣告另一種形式的型態定義. typedef void (*pf_taking_pfv) (pfv);  Now that we have created the pf_taking_pfv typedef as a synonym for the unwieldy "pointer to a function returning void and taking a pfv",  declaring an array of 10 such pointers is a breeze: 此刻我們即可以產生 pf_taking_pfv 型別, 將其型態定義成同義異名的宣告式,使其等同於極為繁複的宣告敘述:"指向返回一無型態的函式並帶有 pfv 的形式參數". 於是定義諸如一個大小為10的函式指標陣列且型別是 pf_taking_pfv, 將是輕而易舉的事情:  pf_taking_pfv p[10];