Jump to content
  • Advertisement
Sign in to follow this  
Iccarus

VS2005 - deprecated functions

This topic is 4446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've just got MS VS 2005 standard edition and have converted my project over from MS 2003.NET. When I try and compile it though I get 283 warnings of deprecated functions in the string.h class. Is there anything I can do to stop this?

Share this post


Link to post
Share on other sites
Advertisement
Don't use those functions, because they're unsafe?

IF you feel like living on the edge, disable warning 4996: Project->Properties->C/C++->Advanced->Disable specific warnings

EDIT: Wait, string.h class? If you're using C++ and you want the C string functions (strncat, strncmp et al.) use #include <cstring>; if you want the C++ std::string class, use #include <string>. If you're using C, string.h is still valid.

Share this post


Link to post
Share on other sites

#pragma warning(disable: 4996)
#include <string.h>



Note that strncpy() isn't necessarily "dangerous" but is still considered deprecated by Microsoft. In fact, strcpy() isn't "dangerous" either if you know what you're doing, which you're SUPPOSED to do when you're programming.

Thought: On the other hand, a programmer who doesn't know what he's doing can be dangerous, even if given just a dull spoon and a paper napkin -- so, perhaps the problem is that programmers aren't necessarily required to pass stringent exams like bridge engineers and architects, rather than whether strcpy() will give you a warning or not...

Share this post


Link to post
Share on other sites
I am already just including <string>. I'm not using strcpy() (AFAIK - I'm pretty sure I've converted everything to c++ strings.)

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
In fact, strcpy() isn't "dangerous" either if you know what you're doing, which you're SUPPOSED to do when you're programming.

No programmers know what they're doing. Good programmers recognize that they don't know what they're doing, and choose their tools accordingly.

Even a programmer who knows the weaknesses of strcpy can still get it wrong due to faulty higher level assumptions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!