Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 284

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 284

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 284

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 284

C语言用宏计算参数个数

尽管对于现代C++而言,计算参数个数不是什么难事。不过还是看到了这个古老的用宏来做的奇淫技巧。

原理其实很简单,展开后通过参数和后面的序列填上宏的参数列表,刚好就能让N对应到参数个数上。

chu's box · 浙ICP备14006917号