関数型の次のtypedef宣言がコンパイルされないのはなぜですか?
typedef void( int ) void_from_int_t;
関数型の次のtypedef宣言がコンパイルされないのはなぜですか?
typedef void( int ) void_from_int_t;
typedef void(void_from_int_t)(int);
宣言は、使用、スパイラルルール、またはこれに対するお気に入りのニーモニックに従います。
typedef
一般に、型定義を作成するには、変数定義に追加するだけです。
// array of ten integers, instance and type
int a[10];
typedef int a_t[10];
// function, declaration and type
void function(int);
typedef void function_t(int);
これは関数ポインタ型ではなく関数型であることに注意してください。星を追加することで取得できます。
function_t* pf = &function;