簡體   English   中英

在預處理程序指令中結合##和_type

[英]combining ## and _type in preprocessor directives

此代碼段中的用法thread##_type的用途是什么? 我知道下划線t (_t)用作命名來標識類型的約定,下划線類型(_type)經常在typedef語句中使用。 我也理解macros ##表示串聯。 _type還有其他用途嗎? (例如使用雙下划線__FILE__ )?

#define THREAD_TYPE(thread)                         
typedef struct                                      \
{                                                   \
   pthread_t pthread;                               \
   int err;                                         \
} thread##_type;

_type在C中沒有特殊含義。此代碼_type作者選擇的方式修飾名稱,僅此而已。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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