Duff's delimiter
Jump to navigation
Jump to search
Example:
switch (int i = 0; count) {
case 0:
for (; i < count; ++i) {
printf(", ");
// fallthrough
default:
printf("%s", strings[i]);
}
}
Invented by Joe Groff (https://twitter.com/jckarter/status/1238669170767585280) and named by John Regehr (https://twitter.com/johnregehr/status/1238670958199635968).
This particular version requires C++17.