C++ Logo

std-proposals

Advanced search

[std-proposals] Allow trailing commas in function calls

From: Ungureanu Radu Andrei <radu.ungureanu_at_[hidden]>
Date: Sun, 17 Aug 2025 18:40:34 +0300
Hello, I propose allowing trailing commas in function calls:

 int add(int a, int b);
 // Both would be valid calls of the function above:
 add(1,2);
 add(1,2,);

This would allow formatters like clang-format to spread arguments across
newlines. For example, the code above could be formatted like this:

 int add(int a, int b);
 add(1,2);
 add(
  1,
  2,
 );

This behavior is similar to using a brace-enclosed initializer list.

It can also be useful for parsing partially written function calls,
allowing tools like clangd to provide information about the
function. I personally found that lacking this feature adds friction
when working on code.

Received on 2025-08-17 15:40:41