簡體   English   中英

這些typedef用途之間有什么區別?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM