danmar / simplecpp

C++ preprocessor
BSD Zero Clause License
209 stars 83 forks source link

__VA_OPT__ is not handled good enough #368

Open danmar opened 1 month ago

danmar commented 1 month ago

Example code:

#define P( x, ...) printf( x __VA_OPT__(,) __VA_ARGS__)
#define PF( x, ...) P( x __VA_OPT__(,) __VA_ARGS__)

int main()
{
    PF( "%s", "Hello" );
}

The output from simplecpp is:

int main ( )
{
 printf  ( "%s"  __VA_OPT__  (  ,  ) "Hello"  ) ;
}