I notice that there are some function return types named *****_t
or ******_st
. What do "_st" and "_t" mean?
views:
91answers:
1
+6
A:
POSIX reserves names ending _t
for types. Although it is quite common to see code that invents its own type names ending _t
, doing so is dangerous - you can run into POSIX systems that define a (different) type with the same name.
In the libmemcached source, it looks like the _st
suffix is used to indicate a structure type:
types.h:typedef struct memcached_st memcached_st;
types.h:typedef struct memcached_stat_st memcached_stat_st;
types.h:typedef struct memcached_analysis_st memcached_analysis_st;
types.h:typedef struct memcached_result_st memcached_result_st;
types.h:// All of the flavors of memcache_server_st
types.h:typedef struct memcached_server_st memcached_server_st;
types.h:typedef const struct memcached_server_st *memcached_server_instance_st;
types.h:typedef struct memcached_server_st *memcached_server_list_st;
I didn't find a single instance of a function ending _st
(but I may not have looked hard enough).
Jonathan Leffler
2010-09-22 07:10:37
nice. In libmemcached source, there many function return types are end with "_t" or "_st". for example
why
2010-09-22 07:17:34
static memcached_server_st *_server_create(memcached_server_st *self, const memcached_st *memc). and so does many other libs.
why
2010-09-22 07:18:11
thank you Jonathan Leffler, I think i am clear with this anyway
why
2010-09-22 07:18:46