Liste des Groupes | Revenir à cl c |
On 09/04/2025 11:49, Michael S wrote:Yeah, pretty much.On Fri, 4 Apr 2025 02:57:10 -0000 (UTC)I am certainly in favour of them for things like initialiser lists and enum declarations.
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>On Thu, 3 Apr 2025 21:48:40 +0100, bart wrote:>
>Commas are overwhelmingly used to separate list elements in>
programming languages.
Not just separate, but terminate.
I disagree. I am in favor of optional trailing commas rather than
mandatory ones.
>...All the reasonable languages allow>
trailing commas.
Are your sure that C Standard does not allow trailing commas?
That is, they are obviously legal in initializer lists.
All compilers that I tried reject trailing comma in function calls.
>But is it (rejection) really required by the Standard? I don't know.Yes. The syntax (in 6.5.2p1) is :
>
>
postfix-expression:
...
postfix-expression ( argument-expression-list opt )
...
argument-expression-list :
argument-expression
argument-expression-list , argument-expression
I don't think it is unreasonable to suggest that it might be nice to allow a trailing comma, at least in variadic function calls, but the syntax of C does not allow it.
Les messages affichés proviennent d'usenet.