让gcc检查变参函数的参数类型
September 1, 2005 on 11:57 am | In Coding, Tech Notes | No Comments (2,674 views)gcc 可以检查 printf 的参数,对于非基本类型的参数,会给个warning, 但是自己实现的变参函数gcc不做检查,这个就需要利用gcc的扩展,加个attribute, 类似下面的
void xlog(LFD *const lfd, const char *fmt, …)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
Powered by WordPress. 京ICP备05059131
Entries and comments feeds.
Brought to you by kang[at]kangkang[dot]org