在函数调用参数前双哈希 [英] Double hash before parameter in function call

查看:107
本文介绍了在函数调用参数前双哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看用C行:

#define log(format, args...) snprintf(buffer + strlen(buffer), 1023 - strlen(buffer), format, ##args);

什么是双英镑/哈希在)的最后一个参数的snprintf(前平均

推荐答案

在标准C中, ## 是一个宏内串联令牌在一起。在这里,这个宏是不是在标准C,但在GNU C,由 GCC 实施的方言。在 ## 是用来删除逗号,如果额外的参数(在 ARGS )变成空。请参见 GCC手册

In standard C, the "##" is for concatenating tokens together within a macro. Here, this macro is not in standard C, but in "Gnu C", the dialect implemented by GCC. The "##" is used to remove the comma if the extra arguments (in args) turn out to be empty. See the GCC manual.

这篇关于在函数调用参数前双哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆