warning C4996: 'foo' was declared deprecated

It appears that several standard C and C++ functions have been 'deprecated' in this version of compiler. This is a major annoyance since neither C nor C++ standards seem to mention this.  Naturally, it is possible to disable unwanted warnings, however doing this manually for every project is a pain in the arse. Is there a compatibility mode

Thanks,

- NK


Answer this question

warning C4996: 'foo' was declared deprecated

  • FJINFANTE

    Thanks again Igor, that is exactly what I meant.

    - NK

  • Gowri Shankar

    Thanks Igor, defining _CRT_SECURE_NO_DEPRECATE solves the problem.


     Boris Jabes wrote:

    Could you be a little more specific Which functions are you speaking of



    In my case it was fopen, fcvt & ecvt (the latter two non-standard ISO). However browsing through standard library files I found plenty of functions tagged with __declspec(deprecated). It would be nice to have some sort of documentation on the topic, eg why those functions are deprecated and how to "undeprecate" them. There is little sense in using the replacement functions if you are writing portable code, the #ifdef clause is simply not worth the trouble.

    - NK

  • wang ya zheng

    Could you be a little more specific Which functions are you speaking of

    Thanks,

    --
    Boris Jabes, Visual C++ Team
    This post is provided "AS IS" and confers no rights



  • Gnome.com

    This is a request for future versions of c and c++ compilers. Because these languages defined by ANSI/ISO standards, the only organizations that can declare c/c++ library functions to be deprecated are ANSI and ISO. I'm requesting that Microsoft please use a different term or explanation for the "depracted" warning messages for functions like strcpy().

    warning C4996: 'strcpy' was declared deprecated

    Perhaps an error message saying something like this:

    warning C4996: 'strcpy' was declared unsecure

    To override these messages, perhaps a definition of _CRT_SECURE_NO_WARNING could be used.

    I appreciate Microsoft's attempt to create replacement library functions that are less exploitable to buffer overrun errors. It would be nice if Microsoft proposed the use of these more secure functions in future ANSI/ISO c/c++ libraries. I know I would adopt them instead of writing my own functions to work around these deficiencies in the standard libraries.

    Cheers,
    Carroll Vance







  • Dirk Strikwerda

    wrote in message news:984ee4f4-2ce6-4c13-a55b-b3c1fd29ea43@discussions.microsoft.com > It would be nice to > have some sort of documentation on the topic, eg why those functions > are deprecated and how to "undeprecate" them. You mean like this http://msdn2.microsoft.com/library/8ef0s5kh -- With best wishes, Igor Tandetnik
  • RoshanShah

    wrote in message news:2417ccde-6739-4f3f-ba95-82df34dec5cd@discussions.microsoft.com > It appears that several standard C and C++ functions have been > 'deprecated' in this version of compiler. This is a major annoyance > since neither C nor C++ standards seem to mention this. Naturally, > it is possible to disable unwanted warnings, however doing this > manually for every project is a pain in the arse. Is there a > compatibility mode In Project Settings, define _CRT_SECURE_NO_DEPRECATE macro. Does not really help much, since you need to do this for every project anyway. In case you are curious, Microsoft marks certain CRT functions with potential security problems as deprecated, and suggests you use secure equivalents. E.g. strcpy can easily result in buffer overrun since it blindly assumes that the receiving buffer is large enough. strcpy_s takes the size of receiving buffer as an additional parameter, and guarantees not to write past the end. -- With best wishes, Igor Tandetnik
  • warning C4996: 'foo' was declared deprecated