[vtkusers] small bug report, extra comma in enum

David Gobbi david.gobbi at gmail.com
Fri Aug 17 23:29:10 EDT 2012


On Fri, Aug 17, 2012 at 8:23 PM, John Drescher <drescherjm at gmail.com> wrote:
> On Fri, Aug 17, 2012 at 10:19 PM, Trevor Irons <trevorirons at gmail.com> wrote:
>> When I compile using gcc on pedantic I've been bothered by a warning for
>> years. Was hoping someone with commit access could spend about 12 seconds
>> and fix this.
>>
>> The warning reads
>> In file included from external/matplot/matplot.h:40:0,
>>                  from
>> /home/tirons/src/Merlin/include/snmrinversion1damp.h:45,
>>                  from
>> /home/tirons/src/Merlin/unittest/utsnmrinversion1dgmrsimul.cpp:40:
>> /usr/local/include/vtk-6.0/vtkXYPlotActor.h:395:28: warning: comma at end of
>> enumerator list [-pedantic]
>>
>> In vtkXYPlotActor.h line 395 there is an extra comma :
>>
>> enum Alignment {
>>   AlignLeft = 0x1,
>>   AlignRight = 0x2,
>>   AlignHCenter = 0x4,
>>   AlignTop = 0x10,
>>   AlignBottom = 0x20,
>>   AlignVCenter = 0x40,
>>   AlignAxisLeft = 0x100,
>>   AlignAxisRight = 0x200,
>>   AlignAxisHCenter = 0x400,
>>   AlignAxisTop = 0x1000,
>>   AlignAxisBottom = 0x2000,
>>   AlignAxisVCenter = 0x4000,         <-- Extra comma right here
>> };
>>
>> I would really appreciate it if someone with commit privileges could remove
>> this.
>>
>
> Isn't that legal in c++? I intentionally make my enums that way..

It was illegal until C++11, though compilers have been lax about it.
So, yes, the extra comma should be removed but I've already
spent more than 12 seconds just typing this email...

Trailing commas in initializer lists have always been legal, though.

 - David



More information about the vtkusers mailing list