我想知道什么是 intptr_t ? (_t) 是什么意思?它是(树)的第一个词还是什么?
例如,在 nginx Web 服务器中,ngx_xx_t (_t) 是什么?
(ngx_xx_t ) 和 (ngx_xx_s) 有什么不同?什么是 (_t) 和 (_s) ? (缩写)
最佳答案
一般来说,后缀_t
指的是typedef
,_s
指的是结构体。对于编译器来说没有什么区别,只是为了用户阅读代码的好处。这曾经是应用此类后缀的常见做法,但由于与 POSIX 冲突和基本的人类混淆,现在不鼓励这样做。其他类似讨论
- Standard for typedef'ing
- Naming scheme for typedefs
- What does a type followed by _t (underscore-t) represent?
- struct (C programming language)
示例:
// Discouraged
struct foo_s {
int bar;
};
typdef struct foo_s foo_t;
// Friendly
typedef struct foo_struct {
int bar;
} foo_type;
关于c++ - intptr_t中_t的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22995831/