1

I just read a open source. In it, I see a some code, it make me unfamiliar. So it is something about the struct:

struct _NameStruct;

typedef struct _NameStruct NameStruct

And after that, they (open source) use NameStruct to contain some variable. I wonder Why struct _NameStruct not yet define some variable so how they can use it?

4

1 に答える 1

5

コードを注意深く読むと、データ型へのポインターしか使用していないことがわかるでしょう。おそらく不透明なデータ型であるため、ポインターを渡すことができますが、実際に実装方法を知る必要はありません。

これらは通常、ライブラリのみが構造体の実装を知る必要があるハンドルなどに使用されます。

于 2013-10-19T02:56:26.917 に答える