visual c++ - C++ - check if safe functions are needed -


When I am using Visual Studio (MSVC), and using the strcat function I'm sorry, then error me

error C4996: 'strcat': This function or variable can be unsafe. Consider using strcat_s instead. To disable exclusion, see _CRT_SECURE_NO_WARNINGS Use Online Help for details.

If I wanted to create a project that was for compilers such as GCC , then there is a way to find out whether it is safe Functions are required, for example MSVC macros?

You can use conditional compilation for cross-platam code such as:

< Pre> #ifdef win strcat_s (... #else strcat (... #endif

MSWC compiler recognizes such calls of such functions as acceptance reject Done and generate a warning at level 3. Therefore, just compile this level with (or more) and see the warnings.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -