|
|

楼主 |
发表于 2005-5-24 12:22:51
|
显示全部楼层
Post by kj501
不过话说回来,楼主没有给出完整的宏定义,很有可能我们都说错了。
真是不好意思,前几天没时间来读各位的高见。我已经明白了大概。
如果要看那个宏及所调用的函数的完整信息,那么看下边:
- #define cpLog(priority__, fmt__, args__...) \
- do {if (priority__ <= cpLogGetPriority()) \
- cpLog_impl_ (priority__, __FILE__, __LINE__, fmt__ , ##args__);} \
- while (0)
复制代码
- /*declaration*/
- extern void cpLog_impl_ (int pri, const char* file, int line, const char* fmt, ...);
复制代码
- /*implementation*/
- void cpLog_impl_(int pri, const char* file, int line, const char* fmt, ...)
- {
- va_list ap;
- if (pri <= CpLogPriority::getPriority())
- {
- Lock lock(cpLogMutex);
- va_start(ap, fmt);
- vCpLog(pri, file, line, fmt, ap);
- va_end(ap);
- }
- /*Illidan note: va_start and va_end are macros, while vCplog is a function.*/
- }
复制代码
Mr. kj501说得很全面 :cool: |
|