![](/img/trans.png)
[英]What's the difference between `typedef struct X { }` and `typedef struct { } X`?
[英]What is the difference between these typedef uses?
之間有什么區別?
typedef struct
{
int a;
int b;
} S1, *S1PTR;
((S1PTR)structure)->b)
和
typedef struct
{
int a;
int b;
} S1;
((S1*)structure)->b)
這些typedef用途之間有什么區別?
與編譯器沒有區別。
這是一種風格差異。
(S1*)structure
看起來像是對指針的強制轉換。
(S1PTR)structure
並不容易看起來像是對指針的(S1PTR)structure
,而是對指針的(S1PTR)structure
。
*
聲音比...PTR
。
另外:僅使用大寫標識符表示#define
暗示,不是。
按照您小組的編碼指南進行編碼。 我使用的不會在這里縱容S1PTR
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.