
On 2/21/2011 4:05 AM, Paul Mensonides wrote:
On Sun, 20 Feb 2011 20:25:43 -0500, Edward Diener wrote:
I think Paul Mensonides may be right and there is no foolproof way to check for a completely empty parameter list even using variadic macros. Further ideas ?
Trust me, I am right. About the best you can do is prohibit input that terminates in a function-like macro name. You can generally detect emptiness *except* for that case.
However, DATA_SIZE() => 0 is ill-conceived. An empty argument is still an argument to the preprocessor. A better correlation is:
DATA_SIZE(,,) => 3 DATA_SIZE(,) => 2 DATA_SIZE() => 1
Thanks ! I will just have to further document that the data size returned can never be 0, even when the variadic macro is invoked with an empty argument.
This is yet another reason why variadic content doesn't make for a good data structure.
Agreed.
There is no way to denote the empty sequence. For all others, there are ways:
(,,) // 3-element tuple (,) // 2-element tuple () // 1-element tuple // 0-element tuple (blank)
()()() // 3-element seq ()() // 2-element seq () // 1-element seq // 0-element seq (blank)