For Programmers: Free Programming Magazines  


Home > Archive > VC STL > February 2006 > deprecated STL functions / Safe Standard C++ library









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author deprecated STL functions / Safe Standard C++ library
Arvind Ganesan

2006-02-11, 7:03 pm

Hi,

I am using Visual Studio 2005. I am playing around and learning to use the
icstring class mentioned in this URL for case-insensitive string
comparision:
http://www.josuttis.com/libbook/str...string.hpp.html

When I try to write a function like this

void func1(icstring copyString)
{
}

I get the following errors:

1>Compiling...
1>TempConsoleApp.cpp
1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(582) :
warning C4996: 'std::_Traits_helper::copy_s' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\iosfwd(597) : see
declaration of 'std::_Traits_helper::copy_s'
1> Message: 'You have used a std:: construct that is not safe. See
documentation on how to use the Safe Standard C++ Library'
1> c:\program files\microsoft visual studio 8\vc\include\xstring(2035) : see
reference to function template instantiation
'std::char_traits<char>::char_type
*std::_Traits_helper::copy_s<_Traits>(std::char_traits<char>::char_type
*,size_t,const std::char_traits<char>::char_type *,size_t)' being compiled
1> with
1> [
1> _Traits=ignorecase_traits
1> ]
1> c:\program files\microsoft visual studio 8\vc\include\xstring(2028) :
while compiling class template member function 'void
std::basic_string<_Elem,_Traits>::_Tidy(bool,__w64 unsigned int)'
1> with
1> [
1> _Elem=char,
1> _Traits=ignorecase_traits
1> ]
1> d:\tempprojects\tempconsoleapp\tempconso
leapp\tempconsoleapp.cpp(57) :
see reference to class template instantiation
'std::basic_string<_Elem,_Traits>' being compiled
1> with
1> [
1> _Elem=char,
1> _Traits=ignorecase_traits
1> ]
1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(600) :
warning C4996: 'std::char_traits<char>::copy' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\iosfwd(446) : see
declaration of 'std::char_traits<char>::copy'
1> Message: 'You have used a std:: construct that is not safe. See
documentation on how to use the Safe Standard C++ Library'
1> c:\program files\microsoft visual studio 8\vc\include\iosfwd(582) : see
reference to function template instantiation
'std::char_traits<char>::char_type
*std::_Traits_helper::copy_s<_Traits>(std::char_traits<char>::char_type
*,size_t,const std::char_traits<char>::char_type
*,size_t,std::_Unsecure_char_traits_tag)
' being compiled
1> with
1> [
1> _Traits=ignorecase_traits
1> ]
1> c:\program files\microsoft visual studio 8\vc\include\xstring(2035) : see
reference to function template instantiation
'std::char_traits<char>::char_type
*std::_Traits_helper::copy_s<_Traits>(std::char_traits<char>::char_type
*,size_t,const std::char_traits<char>::char_type *,size_t)' being compiled
1> with
1> [
1> _Traits=ignorecase_traits
1> ]

However, I am able to write a function with a signature like this without
getting any warnings:

void func2(icstring& refString)
{
}

Does anyone know what I should do to be able to be able to pass around the
icstring class as either a copy or a reference?

Thanks in advance,
Arvind.


Igor Tandetnik

2006-02-11, 7:03 pm

"Arvind Ganesan" <ag@ExtractSystems.com> wrote in message
news:O4kN5A1LGHA.360@TK2MSFTNGP12.phx.gbl
> I am using Visual Studio 2005. I am playing around and learning to
> use the icstring class mentioned in this URL for case-insensitive
> string comparision:
> http://www.josuttis.com/libbook/str...string.hpp.html
>
> When I try to write a function like this
>
> void func1(icstring copyString)
> {
> }
>
> I get the following errors:
>
> 1>Compiling...
> 1>TempConsoleApp.cpp
> 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(582) :
> warning C4996: 'std::_Traits_helper::copy_s' was declared deprecated


Define _SECURE_SCL macro to 0.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Arvind Ganesan

2006-02-11, 7:03 pm

Thanks for your response Igor.

How would the code have to changed so that I can use the checked iterators
instead of just turning it off? I would prefer to use the checked iterators
if possible.

Thanks,
Arvind.

"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:OMHGmN1LGHA.3860@TK2MSFTNGP12.phx.gbl...
> "Arvind Ganesan" <ag@ExtractSystems.com> wrote in message
> news:O4kN5A1LGHA.360@TK2MSFTNGP12.phx.gbl
>
> Define _SECURE_SCL macro to 0.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com