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

variadic macro that handles last argument in a different way

$
0
0

I was wandering if there is a way to define a variadic macro that handles its last argument in a different way.

For example, can I define a macro that prints a custom separator after every argument except for the last one?

i.e. how to define MACRO:

MACRO(a, lot, of, bars)

In order to produce this output:

a|lot|of|bars

(EDIT: it was pointed out to me by the comments that the case of , as separator is trivial)


Viewing all articles
Browse latest Browse all 22072

Trending Articles



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