[vtkusers] vtkStdString vs vtkstd::string

Bill Lorensen bill.lorensen at gmail.com
Thu Jan 14 10:46:07 EST 2010


Jeff,

Let me know when the commit check for blocking std:: and std::cout is
removed. I'll try a few of the examples and see how well they compile
on the vtk platforms.

The VTK ARB does support this experiment.


Bill

On Thu, Jan 14, 2010 at 10:07 AM, Jeff Baumes <jeff.baumes at kitware.com> wrote:
> I wasn't aware of namespace aliasing. If our supported compilers
> support it, I'm all for it. But again, we have to do some testing
> first to see how using std:: goes before we make that switch.
>
> Jeff
>
> On Thu, Jan 14, 2010 at 9:59 AM, Marcus D. Hanwell
> <marcus.hanwell at kitware.com> wrote:
>> I am with Francois, can we use namespace aliasing? I think with the work I
>> have been doing (when I have had time) on GCC default visibility in VTK
>> keeping the symbols short should be much less of an issue with supported
>> compilers too. Initial indications are a 30-40% drop in exported symbols in
>> most kits.
>>
>> Marcus
>>
>> On Thursday 14 January 2010 09:24:44 Francois Bertel wrote:
>>> As a macro hater, can I suggest "namespace aliasing" instead?
>>>
>>> Here is what I mean with a full example (just tested with gcc 4.4.1)
>>>
>>> #include <iostream>
>>>
>>> int main()
>>> {
>>>   // define vtkstd as an alias to std
>>>   namespace vtkstd=std;
>>>
>>>   vtkstd::cout << "hello" << vtkstd::endl;
>>>
>>>   return 0;
>>> }
>>>
>>> On Thu, Jan 14, 2010 at 9:09 AM, Jeff Baumes <jeff.baumes at kitware.com>
>> wrote:
>>> > On Wed, Jan 13, 2010 at 7:15 PM, David Doria <daviddoria+vtk at gmail.com>
>> wrote:
>>> >> The doc for vtkStdString says:
>>> >>
>>> >> Wrapper around vtkstd::string to keep symbols short.
>>> >> vtkStdString derives from vtkstd::string to provide shorter symbol
>>> >> names than basic_string<...> in namespace std given by the standard
>>> >> STL string.
>>> >>
>>> >> But I guess I don't understand what that means. When should one use
>>> >> vtkStdString vs vtkstd::string?
>>> >
>>> > I don't know the answer to your question, but it would be nice if all
>>> > these pointed to the same underlying thing: std::string. I'm assuming
>>> > the older compilers are responsible for the need for short symbols.
>>> > Perhaps the compiler deprecation that Berk sent recently will allow us
>>> > to eventually replace all vtkStdString and vtkstd::string with
>>> > std::string?
>>> >
>>> > We are thinking to maybe start testing the use of std::string in the
>>> > examples first.
>>> >
>>> > Longer term, we could do something like the following:
>>> >
>>> > typedef std::string vtkStdString;
>>> > #define vtkstd std
>>> >
>>> > So the old type names could still be used, but we could in time
>>> > replace all occurrences in VTK to just use std::string. Eventually the
>>> > old aliases could be removed.
>>> >
>>> > But there could be unforeseen issues with this idea that force us to
>>> > continue using vtkStdString/vtkstd::string.
>>> >
>>> > Jeff
>>> > _______________________________________________
>>> > Powered by www.kitware.com
>>> >
>>> > Visit 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
>>>
>>
>> --
>> Marcus D. Hanwell, Ph.D.
>> R&D Engineer, Kitware Inc.
>> (518) 881-4937
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit 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
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit 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
>



More information about the vtkusers mailing list