Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22001

C Preprocessor Remove Trailing Comma

$
0
0

I have a macro like this:

#define C( a... ) ( char *[] ){ a, 0 }

This works for non-empty arguments:

C( "a", "b" ) => ( char *[] )( "a", "b", 0 }

But I want to remove the trailing comma when provided with an empty argument:

C() => ( char *[] ){ , 0 }

Is this possible?


Viewing all articles
Browse latest Browse all 22001

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>