Re: Possible __VA_OPT__ bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Edward,

On Thu, Oct 31, 2019 at 12:42:54PM -0400, Edward Diener wrote:
> Given:
> 
> #define NO_DATA
> #define TRY_VA_OPT(...)  __VA_OPT__ (0) 1
> 
> TRY_VA_OPT() -> expands to 1 as expected
> TRY_VA_OPT(NO_DATA) -> expands to 0 1 which is not expected
> 
> when compiled with gcc-9.2 with -std=c++2a.

Why is that not expected?  The variadic macro TRY_VA_OPT does get tokens
in its variable argument (namely, NO_DATA), so __VA_OPT__ expands to its
argument (which is 0).

https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux