文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>宏定义 __VA_ARGS__

宏定义 __VA_ARGS__

时间:2009-03-06  来源:朝花夕拾

在jos代码里看到宏__VA_ARGS__

在gcc info里面找到 $ info gcc

然后输入'/__VA_ARGS__'搜索到下面的文字

(其实大部分时候man和info就能解决问题,很多时候我们就是不愿意静下心来读)

5.17 Macros with a Variable Number of Arguments.
================================================

In the ISO C standard of 1999, a macro can be declared to accept a
variable number of arguments much as a function can. The syntax for
defining the macro is similar to that of a function. Here is an
example:

  #define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)

 Here `...' is a "variable argument". In the invocation of such a
macro, it represents the zero or more tokens until the closing
parenthesis that ends the invocation, including any commas. This set of
tokens replaces the identifier `__VA_ARGS__' in the macro body wherever
it appears. See the CPP manual for more information.

 GCC has long supported variadic macros, and used a different syntax
that allowed you to give a name to the variable arguments just like any
other argument. Here is an example:

  #define debug(format, args...) fprintf (stderr, format, args)

 This is in all ways equivalent to the ISO C example above, but arguably
more readable and descriptive.

....
相关阅读 更多 +
排行榜 更多 +
爱是小事最新版

爱是小事最新版

休闲益智 下载
悬案2刹那惊颤游戏

悬案2刹那惊颤游戏

冒险解谜 下载
几何飞行内购修改版

几何飞行内购修改版

飞行射击 下载