- 작성시간 : 2009/10/23 11:54
- 퍼머링크 : kaludin.egloos.com/2461933
- 카테고리 : 에러가싫어요
■ Deprecated
- 포직스 함수들중 몇몇함수들이 visual studio 2005에서 부터 다른 함수들로 바뀌면서 Warning이 뜨게 된다.
새로 정의 된 함수들로 바꾸어 주라는 의미이다. MS 독자의 길을 가겠다는 의미인지 아니면 예전함수들의 에러나 버그를 고친
버전이 일 것이다
경고 2 warning C4996: 'sprintf'이(가) deprecated로 선언되었습니다. d:\data\tsource\mfclog\mfclog.cpp 108
보안(security)을 강화하면서 예전 함수에는 Warning를 띄우나보다. -.-;;
Warnnig이 떠도 특별히 문제없이 쓸수는 있다고 한다.
MS에는 밑에 같이 쓰면 저 Warnning은 표시안다고 했는데 잘 안된다.
#define _CRT_SECURE_NO_DEPRECATE 1
밑에 같이 써주면 Warnning이 표시되어지지않는다.
#pragma warning(disable:4996)
Warnning이 표시되어지지 않는다고 문제가 해결된 것은 아니고 가장 좋은 것은 MS가 추천하는 함수로 바꾸는 것이 가장 좋을 것 같다.
Warnning이 뜨는게 먼가 찝찝하면 ctrl+F5을 눌러서 해당 함수를 검색하여 새로 바뀐 함수로 사용하면 말끔히 사라진다.
--------------------------------------------------------------
http://msdn2.microsoft.com/en-us/library/ms235384(VS.80).aspx
Run-Time Library Reference
Deprecated CRT functions and their recommended replacements.
Deprecated POSIX functions
The following POSIX names for functions are deprecated. In most cases, prepending an underscore character gives the standard equivalent name. Note that some functions have more secure versions ("_s" suffix).
You can also eliminate POSIX deprecation warnings by defining _CRT_NONSTDC_NO_DEPRECATE.
| Deprecated function | Replacement function |
|---|---|
Security-enhanced functions
The following functions should be avoided because a more secure version of the function should be used instead. For more information, see Security Enhancements in the CRT.
| Deprecated function | Security-enhanced replacement |
|---|---|
vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l | vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l |
vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l | |
Functions with Secure Template Overloads
Some of the functions in the preceding section have secure template overloads which can eliminate deprecation warnings by replacing calls to deprecated functions with calls to the new secure versions of those functions. For more information, see Secure Template Overloads.
----------------------------------------------------------
다른 참조할 만한 링크
Security Enhancements in the CRT(C Run-Time Libraries)
http://msdn2.microsoft.com/en-us/library/8ef0s5kh(VS.80).aspx



덧글