1

関数型の次のtypedef宣言がコンパイルされないのはなぜですか?

typedef void( int ) void_from_int_t;
4

2 に答える 2

2

typedef void(void_from_int_t)(int);宣言は、使用、スパイラルルール、またはこれに対するお気に入りのニーモニックに従います。

于 2013-01-27T02:24:04.033 に答える
0

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;
于 2013-01-27T17:00:57.697 に答える