Safe Libraries: Standard C++ Library
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Safe Libraries: Standard C++ Library 

Beginning with Visual C++ 2005, several enhancements have been made to the libraries that ship with Visual C++, including the Standard C++ Library, to make them more secure.

Several methods in the Standard C++ Library have been identified as potentially unsafe because they could lead to a buffer overrun or other code defect. The use of these methods is discouraged, and new, safer methods have been created to replace them. These new methods all end in _s.

Several enhancements have also been made to make iterators and algorithms more secure. For more information, see Checked Iterators and Debug Iterator Support.

The following table lists the Standard C++ Library methods that are potentially unsafe, as well as their safer equivalent:

If you call any one of the potentially unsafe methods above, or if you use iterators incorrectly, the compiler will generate Compiler Warning (level 1) C4996. For information on how to disable these warnings, see _SCL_SECURE_NO_WARNINGS.

© 2016 Microsoft