Naming Conventions in UNIX C Functions (_t and _st)

I noticed that there are some types of return functions called *****_tor ******_st. What do "_st" and "_t" mean?

+3
source share
1 answer

POSIX reserves names ending in _tfor types. Although it often happens that code that invents proper type names ending in _tdoes it, it is dangerous - you can run POSIX systems that define a (different) type with the same name.


In the libmemcached source, it looks like the suffix is _stused to indicate the type of structure:

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;

, _st ( , , ).

+7

Source: https://habr.com/ru/post/1765949/


All Articles