C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow comma at the end of a list of objects in a declaration or definition

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Sun, 7 May 2023 19:04:35 +0200
Il 07/05/23 18:44, Frederick Virchanza Gotham via Std-Proposals ha scritto:
> We already allow a comma at the end of initialiser lists and enums,
> and so I propose that we also allow a trailing comma in the following:

When you say "I propose", could you please attach an actual proposal,
not just ideas?


> int a, b, c, ;
>
> The reason why I want that comma after 'c' is that sometimes I write
> a source file as follows:
>
> std::jthread
> thread_listener,
> thread_sender,
> thread_monitor
> ;
>
> When I add a new variable called 'thread_socket', I want the diff file
> in SVN and Git to simply show that I've added a new line. But instead,
> it shows that I've edited one line and added one line, as follows:
>
> - thread_monitor
> + thread_monitor,
> + thread_socket

Or: just declare one variable per line and you won't have this mess with
the diffs.

A place where this is slightly more annoying is in ctor-initializers,
but P0562/P2067 were rejected.

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2023-05-07 17:04:40