<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155234>155234</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
__VA_COUNT__: Count number of variadic arguments in a variadic macro
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alejandro-colomar
</td>
</tr>
</table>
<pre>
Hi!
While you can do this already with macro trickery, it requires some very unreadable code. I'd like to be able to extract that information directly in a way similar to how `__VA_OPT__()` works.
```c
#define foo(a, b, ...) __VA_COUNT__
foo(a, b, c, d)
```
The code above would expand to
```c
2
```
Cc: @AaronBallman
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxskk1v2zwMxz-NfCFqSPRLk4MPaR4Ezy7rDt12DGiJidXKUifJSf3tBzvF3gGBgkTyR1L6U0r27Jk70TyI5r-CpjyE2JHjZ_ImhjsdXBgpFn0wc_e_FaiE3Am5-zpYxzCHCTR5MAHyYBOQi0xmhqvNA4ykY4AcrX7hOAvcg80Q-dtkIydIYWS4cJxh8ksS9Y5BB8MlwAeB9wacfWHIAXqG1ZkD8FuOpDPkgTJYfwpxpGyDB2Mj6-xmsB4IrjRDsqN1FJesIVxBtPJ4_LI7Pn56Oh4FbgRuRSvhGuJLKm8jiVbell4OWBk-Wc9wCkHghpb--8WUZSlwC7Di9o-fPy7AFfBnpF6MWSr9Ar-FPg23YYH6cGG4hskZ4LdX8gZy-Ec_-Ddjr0W1A1HLHcXgH8i5kTwUpqvMttpSwZ26b1qFqq7bYuhw27SyPym13RjVK61ORlHfyvuWdK83qrAdSmzkBhulKlnLstaNVogbbBpGpRtRSx7JutK5y1iGeC5sShN3qmmwqgtHPbu0KgnR8xVWr0BchBW7Jemun85J1NLZlNNPTLbZcffbg1Y72IfJZ_DT2HOEcIILRUvGaqB4nkb2Od1--8f9Krhiiq4bcn5NotoJPAg8nG0epr7UYRR4WIq-b3evMTyzzgIPa6tJ4OF9lkuH3wMAAP__Jg72ng">