[vtk-developers] Fwd: Unique enum values

Kyle Lutz kyle.lutz at kitware.com
Thu Mar 15 10:00:45 EDT 2012


---------- Forwarded message ----------
From: Kyle Lutz <kyle.lutz at kitware.com>
Date: Thu, Mar 15, 2012 at 9:58 AM
Subject: Re: [vtk-developers] Unique enum values
To: Bill Lorensen <bill.lorensen at gmail.com>


On Wed, Mar 14, 2012 at 9:20 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Perhaps you are correct. It may just be a wrapping issue.
>
>
> On Wed, Mar 14, 2012 at 6:18 PM, Marcus D. Hanwell
> <marcus.hanwell at kitware.com> wrote:
>> Why would it be disruptive? If we are changing it globally it will be
>> disruptive either way. We have to start somewhere if we are ever going
>> to start, and this looks a lot like an enum inside a class called vtk.
>> My main concern would be the wrappers as I said before, but I would
>> love to be able to put them in a namespace (far less repetition of
>> VTK_ before each declaration).
>>
>> I am guessing for enums inside of classes we are going to leave them alone.
>>
>> On Wed, Mar 14, 2012 at 9:13 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> Since we don't use namespace vtk any where else, VTK_ prefix may be
>>> less disruptive.
>>>
>>> On Wed, Mar 14, 2012 at 6:00 PM, Marcus D. Hanwell
>>> <marcus.hanwell at kitware.com> wrote:
>>>> I was thinking the same,
>>>>
>>>> namespace vtk
>>>> {
>>>> enum OperationType
>>>> {
>>>>  UNION=0,
>>>>  INTERSECTION,
>>>>  DIFFERENCE
>>>> }
>>>> } // End vtk namespace
>>>>
>>>> Then vtk::UNION, but I have no idea how that works with the wrapping.
>>>> Last I heard I still couldn't use anything other than anonymous enums
>>>> either - it would be great if that has improved.
>>>>
>>>> Marcus
>>>>
>>>> On Wed, Mar 14, 2012 at 8:49 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>>> namespaces are great. ITK has used them for over 10 ten years. But I'm
>>>>> not sure how to use them just for enum's.
>>>>>
>>>>>
>>>>> On Wed, Mar 14, 2012 at 5:31 PM, David E DeMarle
>>>>> <dave.demarle at kitware.com> wrote:
>>>>>> Is there any reason not to use namespaces anymore?
>>>>>>
>>>>>> On Mar 14, 2012 7:21 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:
>>>>>>>
>>>>>>> Folks,
>>>>>>>
>>>>>>> A user recently reported that an enum value "DIFFERENCE" was defined
>>>>>>> by Visual Studio 2008. This caused compilation errors in the vtk class
>>>>>>> that defined and used it.
>>>>>>>
>>>>>>> VTK classes that define enums do not follow a consistent convention.
>>>>>>> Some use a VTK_ prefix, others do not.
>>>>>>>
>>>>>>> Without a unique prefix VTK may have compilation issues if, in the
>>>>>>> future, a compiler decides to define one of the values that we have
>>>>>>> created.
>>>>>>>
>>>>>>> I propose, that for VTK6, we establish a convention that enum values
>>>>>>> always have a prefix VTK_.
>>>>>>>
>>>>>>> About 370 vtk*.h files have an enum. I'm willing to take a stab at
>>>>>>> applying this convention throughout VTK.
>>>>>>>
>>>>>>> Bill
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>

+1 to the vtk:: namespace.

Qt takes a similar approach by using the Qt:: namespace for its global enums.

-kyle



More information about the vtk-developers mailing list