D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4134 - Trailing comma allowed in parameter lists
Summary: Trailing comma allowed in parameter lists
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2010-04-29 09:32 UTC by Aziz Köksal
Modified: 2014-02-15 02:18 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Aziz Köksal 2010-04-29 09:32:56 UTC
Example:

void main(char[][] args,)
{}
Comment 1 Ellery Newcomer 2010-04-29 11:20:25 UTC
Sweet. How long has this feature been available?
Comment 2 Simen Kjaeraas 2010-04-30 03:43:48 UTC
This is allowed for simplicity with generated code, I believe. Makes it a bit easier to generate parameter lists, enumeration enums (darn those other enums), etc.

It's been around for as long as I can remember, and hopefully won't ever be 'fixed'.
Comment 3 Aziz Köksal 2010-04-30 05:50:36 UTC
(In reply to comment #2)
> This is allowed for simplicity with generated code, I believe. Makes it a bit
> easier to generate parameter lists, enumeration enums (darn those other enums),
> etc.
>

This would make more sense for array literals, because generating them should happen much more often than generating parameter lists.

I have no problem with trailing commas, but it's not consistently allowed everywhere.
Comment 4 Don 2010-04-30 05:55:50 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > This is allowed for simplicity with generated code, I believe. Makes it a bit
> > easier to generate parameter lists, enumeration enums (darn those other enums),
> > etc.
> >
> 
> This would make more sense for array literals, because generating them should
> happen much more often than generating parameter lists.
> 
> I have no problem with trailing commas, but it's not consistently allowed
> everywhere.

See bug 2477.