Click here to Skip to main content
15,301,414 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Today, before I rebuilt a C++ library and its unit test program, I decided to enable SDL checks in the project settings for the unit tests. SDL checks were enabled in the library project when it was upgraded from Visual Studio 6 to Visual Studio 2013, and its compilation listings call out a dozen or SDL warnings, mostly around _tsprintf, which I may never fix, because I don't see them as truly broken.

I have many other projects, all having SDL checks enabled, many with unresolved warnings around _tprintf and other deprecated CRT functions. To date, none of these has presented a problem.

I recently discovered and began using #progrma deprecate to flag certain of my own older functions, to remind me to eventually replace them with their successors. Until today, these deprecated functions have never prevented me compiling and linking a library. The only thing I can see that may differentiate this project from the others is that its output is a character mode program, while the others are dynamic-link libraries.

There is a discussion on Stack Overflow that gave me the hint that I needed to get moving. However, IMO, the proposed solution begs the question; why is this usage of pragma warning flagged as an error, while every other instance is a warning?

What I have tried:

What I tried, which worked, is eliminating the SDL checkes.
Posted
Updated 2-Aug-16 22:25pm

1 solution

See /sdl (Enable Additional Security Checks)[^]:
Quote:
These checks include extra security-relevant warnings as errors

Quote:
/sdl enables these warnings as errors:
...
C4995

You get what you asked for.
   
Comments
David A. Gray 3-Aug-16 13:39pm
   
Thank you. Now, I have some homework to do regarding the security life cycle settings.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900