Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can the macros below be used for?

Tags:

c

macros

#define MEMCACHED_COMMAND_GET(arg0, arg1, arg2, arg3, arg4)
#define MEMCACHED_COMMAND_GET_ENABLED() (0)

The macros above seems totally useless ,what can they be used for??

like image 748
mysql_go Avatar asked Mar 31 '11 15:03

mysql_go


1 Answers

There is probably several definitions for those macros, and you will pick one or another depending on a compilation flag. This enable for instance debug information to be provided only when built in debug mode.

For instance, in memcached_dtrace.h, there is something like:

#if ENABLE_DTRACE
...
#define MEMCACHED_COMMAND_GET(arg0, arg1, arg2) \
    __dtrace_memcached___command__get(arg0, arg1, arg2)
#define MEMCACHED_COMMAND_GET_ENABLED() \
    __dtraceenabled_memcached___command__get()
...
#else
...
#define MEMCACHED_COMMAND_GET(arg0, arg1, arg2)
#define MEMCACHED_COMMAND_GET_ENABLED() (0)
...
#endif

Those commands only do something when ENABLE_DTRACE is activated at build time.

like image 112
tonio Avatar answered Oct 29 '22 14:10

tonio