Originally Posted by
Aisthesis
interesting the discussion on deprecation and IDEs.
to Salem: So, if the number is supposed to be the SIZE of the destination string buffer, and my destination string buffer is FullName[46], does that mean that I need to use 46 every time? like as first command
strcpy_s(FullName, 46, Last);
Yes, that or better yet, sizeof(FullName).
I also agree that some functions cannot simply be wrapped in macros. They can be a little more problematic, and perhaps should be avoided by newbies, but strcat_s and strcpy_s are very, very easy using macros:
Code:
#ifndef _MSC_VER
#define strcpy_s(dst, dst_length, src) strcpy(dst, src)
#endif
And one should also remember that these so called "secure" functions may not be secure (misleading name), but they DO protect against programmer mistakes, such as out-of-bounds writing which is helpful to any programmer to aid in debugging and especially to newbies who can very easily make such mistakes.
So when compiling in MSVC, we get added debugging functionality (good), and if we compile in another compiler, it will still compile due to the macro wrapper, so it essentially becomes ISO standard code (good). So no harm comes at all.
This is what I base my suggestion at.
I might or might not suggest the same for other "safe" functions. And I do agree that there's a lot of broken documentation and a poor word of saying they aren't recommended.