[vtk-developers] vtkStdString vs std::string

Aashish Chaudhary aashish.chaudhary at kitware.com
Thu Feb 21 10:12:30 EST 2013


On Thu, Feb 21, 2013 at 9:59 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> It does exist in some public API, and some functions return it too. We
> also have vtkStringArray - should that be changed to use std::string
> instead of vtkStdString? We also have some code to support
> vtkUnicodeString in public API, although not very much.
>
> I am totally in favor of moving to std::string - although I don't know
> if we want to do a mass renaming - are we talking changing
> recommendation here, or trying to go through VTK and entirely remove
> vtkStdString? Berk expressed support for using std::string last year
> along with limited use of other STL types in headers outside of
> Common, although we never found the time to do much.

I am in favor of removing vtkStdString altogether, unless there is a
technical issue (seems none now), for the sake of clarity and
consistency (time permitting).

>
> On Thu, Feb 21, 2013 at 9:35 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> I'm not sure if vtkStdString exists in any of the public API.
>>
>>
>> On Thu, Feb 21, 2013 at 9:24 AM, Aashish Chaudhary
>> <aashish.chaudhary at kitware.com> wrote:
>>>
>>> +1 for std::string
>>>
>>> On Thu, Feb 21, 2013 at 9:03 AM, Bill Lorensen <bill.lorensen at gmail.com>
>>> wrote:
>>> > +1 for std::string as long as it does not break the public API
>>>
>>> Bill, can you elaborate  "as long as it does not break the public
>>> API"? For the public API we stick to char*. Is that what you meant
>>> here?
>>>
>>> Thanks,
>>>
>>>
>>> >
>>> >
>>> > On Thu, Feb 21, 2013 at 8:12 AM, Kyle Lutz <kyle.lutz at kitware.com>
>>> > wrote:
>>> >>
>>> >> +1 for std::string.
>>> >>
>>> >> -kyle
>>> >>
>>> >> On Wed, Feb 20, 2013 at 10:42 PM, David Thompson
>>> >> <david.thompson at kitware.com> wrote:
>>> >> > Hi JC,
>>> >> >
>>> >> > At least one reason vtkStdString exists is because old versions of
>>> >> > SunCC
>>> >> > could not compile std::map<std::string,std::string> as the template
>>> >> > expansions resulted in class names exceeding a fixed string length in
>>> >> > the
>>> >> > compiler (strings were templated on character type in Sun's STL).
>>> >> > That is no
>>> >> > longer a concern and when we dropped support for old compilers a
>>> >> > while back,
>>> >> > std::string became allowed.
>>> >> >
>>> >> >         David
>>> >> >
>>> >> > On Feb 20, 2013, at 5:56 PM, Jean-Christophe Fillion-Robin
>>> >> > <jchris.fillionr at kitware.com> wrote:
>>> >> >
>>> >> >> Hi Folks,
>>> >> >>
>>> >> >> What is the advantages of one vs the other? Looking at the current
>>> >> >> code
>>> >> >> base, seems both are widely used.
>>> >> >>
>>> >> >>
>>> >> >> $ rm -rf Common/Core/vtkStdString.*
>>> >> >> $ ack -c -l -h "std\:\:string" | cut -d":" -f2 | awk '{s+=$1} END
>>> >> >> {print s}'
>>> >> >> 1583
>>> >> >> $ ack -c -l -h "vtkStdString" | cut -d":" -f2 | awk '{s+=$1} END
>>> >> >> {print
>>> >> >> s}'
>>> >> >> 2104
>>> >> >>
>>> >> >>
>>> >> >> Are the following reason still valid:
>>> >> >>     - allow forward declaration hence reducing the number of header
>>> >> >> inclusion, and also speed compilation.
>>> >> >>     - shorter symbol name. See [1]
>>> >> >>
>>> >> >>
>>> >> >> As a best practice, should we recommend one vs the other ?
>>> >> >>
>>> >> >> Thanks
>>> >> >> Jc
>>> >> >>
>>> >> >> [1] http://www.vtk.org/pipermail/vtkusers/2010-January/105450.html
>>> >> >>
>>> >> >> --
>>> >> >> +1 919 869 8849
>>> >> >> _______________________________________________
>>> >> >> 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
>>> >> >>
>>> >> >
>>> >> > David Thompson
>>> >> > R&D Engineer – Kitware, Inc.
>>> >> > david.thompson at kitware.com
>>> >> > (919)869-8868
>>> >> > Suite G-4
>>> >> > 101 E. Weaver St.
>>> >> > Carrboro, NC 27510
>>> >> >
>>> >> > _______________________________________________
>>> >> > 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
>>> >> >
>>> >> _______________________________________________
>>> >> 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
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> | Aashish Chaudhary
>>> | R&D Engineer
>>> | Kitware Inc.
>>> | www.kitware.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
>>
>>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com



More information about the vtk-developers mailing list