[vtkusers] small bug report, extra comma in enum

Trevor Irons trevorirons at gmail.com
Mon Aug 20 12:19:38 EDT 2012


On 19 August 2012 15:04, Xiaofeng Z <xf10036 at outlook.com> wrote:

> The author says the comma was intentional.  Obviously it's not simply
> about the time it takes to remove it.  I can see a good reason why the
> comma is there.
>

What is the good reason?


> My approach is typically to end a enum with like, for this case,
> AlignInvalid=0xFFFF.
>
> Xiaofeng Zhao
>
>
> ------------------------------
> Date: Sat, 18 Aug 2012 03:38:03 +0000
> From: trevorirons at gmail.com
> To: david.gobbi at gmail.com
> CC: vtkusers at vtk.org
> Subject: Re: [vtkusers] small bug report, extra comma in enum
>
>
> arguably the email was more work...
>
> I know it's now a big deal, but I like compiling with pedantic and I'm
> always hit with this. Although it's the *only* warning I see (though not
> very comprehensive coverage) in VTK. So good on all the VTK developers.
> Thanks.
>
> -- Trevor
>
>
>
> On 18 August 2012 03:29, David Gobbi <david.gobbi at gmail.com> wrote:
>
> 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
>
>
>
> _______________________________________________ Powered by www.kitware.comVisit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html Please keep messages
> on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Follow
> this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120820/6fdb5c03/attachment.htm>


More information about the vtkusers mailing list