프로그래밍 노트

VC6에서는 에러 안났는데 2005로 컴파일 하면 워닝이 뜸 -.-;; (deprecated) 본문

MFC TIP

VC6에서는 에러 안났는데 2005로 컴파일 하면 워닝이 뜸 -.-;; (deprecated)

띠리 2007. 4. 13. 17:19
경고 2 warning C4996: 'sprintf'이(가) deprecated로 선언되었습니다. d:\data\tsource\mfclog\mfclog.cpp 108

보안(security)을 강화하면서 예전 함수에는 워닝을 띄우나보다. -.-;;
워닝이 떠도 특별히 문제없이 쓸수는 있다고 한다.


deprecate 뜻을 몰라 찾아봤다.
deprecate :~을 옳지 않다고 역설하다., 계획 따위에 반대하다.

MS는 하기 왼쪽에 있는 함수들을 옳지않다고 생각하고 있나보군 -.-;;

MS에는 밑에 같이 쓰면 저 워닝은 표시안다고 했는데 잘안된다.

#define _CRT_SECURE_NO_DEPRECATE 1

밑에 같이 써주면 워닝이 표시되어지지않는다.

#pragma warning(disable:4996)

워닝이 표시되어지지않는다고 문제가 해결된 것은 아니고
가장 좋은 것은 MS가 추천하는 함수로 바꾸는 것이 가장 좋을 것같기는 하다.
하지만 귀찮다. -.-;;




--------------------------------------------------------------

http://msdn2.microsoft.com/en-us/library/ms235384(VS.80).aspx

Run-Time Library Reference 
Deprecated CRT Functions 

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

access

_access, _access_s

cabs

_cabs

cgets

_cgets, _cgets_s

chdir

_chdir

chmod

_chmod

chsize

_chsize, _chsize_s

close

_close

cprintf

_cprintf, _cprintf_s

cputs

_cputs

creat

_creat

cscanf

_cscanf, _cscanf_s

cwait

_cwait

dup

_dup

dup2

_dup2

ecvt

_ecvt, _ecvt_s

eof

_eof

execl

_execl

execle

_execle

execlp

_execlp

execlpe

_execlpe

execv

_execv

execve

_execve

execvp

_execvp

execvpe

_execvpe

fcloseall

_fcloseall

fcvt

_fcvt, _fcvt_s

fdopen

_fdopen

fgetchar

_fgetchar

filelength

_filelength

fileno

_fileno

flushall

_flushall

fputchar

_fputchar, _fputwchar

gcvt

_gcvt, _gcvt_s

getch

_getch

getche

_getche

getcwd

_getcwd, _wgetcwd

getpid

_getpid

getw

_getw

hypot

_hypot

inp

_inp

inpw

_inpw

isascii

__isascii

isatty

_isatty

iscsym

__iscsym

iscsymf

__iscsymf

itoa

_itoa, _itoa_s

j0

_j0

j1

_j1

jn

_jn

kbhit

_kbhit

lfind

_lfind, _lfind_s

locking

_locking

lsearch

_lsearch, _lsearch_s

lseek

_lseek

ltoa

_ltoa, _ltoa_s

memccpy

_memccpy

memicmp

_memicmp

mkdir

_mkdir

mktemp

_mktemp, _mktemp_s

open

_open

outp

_outp

outpw

_outpw

putch

_putch

putenv

_putenv, _putenv_s

putw

_putw

read

_read

rmdir

_rmdir

rmtmp

_rmtmp

setmode

_setmode

sopen

_sopen, _sopen_s

spawnl

_spawnl

spawnle

_spawnle

spawnlp

_spawnlp

spawnlpe

_spawnlpe

spawnv

_spawnv

spawnve

_spawnve

spawnvp

_spawnvp

spawnvpe

_spawnvpe

strcmpi

_stricmp

strdup

_strdup

stricmp

_stricmp

strlwr

_strlwr, _strlwr_s

strnicmp

_strnicmp

strnset

_strnset, _strnset_s

strrev

_strrev

strset

_strset, _strset_s

strupr

_strupr, _strupr_s

swab

_swab

tell

_tell

tempnam

_tempnam

toascii

__toascii

tzset

_tzset

ultoa

_ultoa, _ultoa_s

umask

_umask, _umask_s

ungetch

_ungetch

unlink

_unlink

wcsdup

_wcsdup

wcsicmp

_wcsicmp

wcsicoll

_wcsicoll

wcslwr

_wcslwr, _wcslwr_s

wcsnicmp

_wcsnicmp

wcsnset

_wcsnset, _wcsnset_s

wcsrev

_wcsrev

wcsset

_wcsset, _wcsset_s

wcsupr

_wcsupr, _wcsupr_s

write

_write

y0

_y0

y1

_y1

yn

_yn

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

_alloca

_malloca

asctime

asctime_s

_cgets, _cgetws

_cgets_s, _cgetws_s

_chsize

_chsize_s

_controlfp

_controlfp_s

_creat

_sopen_s

_cscanf

_cscanf_s

_cscanf_l

_cscanf_s_l

ctime

ctime_s

_ctime32

_ctime32_s

_ctime64

_ctime64_s

_cwscanf

_cwscanf_s

_cwscanf_l

_cwscanf_s_l

_ecvt

_ecvt_s

_fcvt

_fcvt_s

fopen

fopen_s

freopen

freopen_s

fscanf

fscanf_s

_fscanf_l

_fscanf_s_l

fwscanf

fwscanf_s

_fwscanf_l

_fwscanf_s_l

_gcvt

_gcvt_s

getenv

getenv_s

gets, _getws

gets_s, _getws_s

gmtime

_gmtime_s

_gmtime32

_gmtime32_s

_gmtime64

_gmtime64_s

_i64toa

_i64toa_s

_i64tow

_i64tow_s

_itoa

_itoa_s

_itow

_itow_s

localtime

_localtime_s

_localtime32

_localtime32_s

_localtime64

_localtime64_s

_ltoa, _ltow

_ltoa_s, _ltow_s

_mbccpy

_mbccpy_s

_mbccpy_l

_mbccpy_s_l

_mbscat

_mbscat_s

_mbscpy

_mbscpy_s

_mbslwr, _mbslwr_l

_mbslwr_s, _mbslwr_s_l

_mbsnbcat, _mbsnbcat_l

_mbsnbcat_s, _mbsnbcat_s_l

_mbsnbcpy, _mbsnbcpy_l

_mbsnbcpy_s, _mbsnbcpy_s_l

_mbsnbset

_mbsnbset_s

_mbsnbset_l

_mbsnbset_s_l

_mbsncat

_mbsncat_s

_mbsncat_l

_mbsncat_s_l

_mbsncpy

_mbsncpy_s

_mbsncpy_l

_mbsncpy_s_l

_mbsnset

_mbsnset_s

_mbsnset_l

_mbsnset_s_l

mbsrtowcs

mbsrtowcs_s

_mbsset

_mbsset_s

_mbsset_l

_mbsset_s_l

_mbstok

_mbstok_s

_mbstok_l

_mbstok_s_l

mbstowcs, _mbstowcs_l

mbstowcs_s, _mbstowcs_s_l

_mbsupr, _mbsupr_l

_mbsupr_s, _mbsupr_s_l

memcpy

memcpy_s

memmove

memmove_s

_mktemp

_mktemp_s

_open

_sopen_s

scanf

scanf_s

_scanf_l

_scanf_s_l

_searchenv

_searchenv_s

setbuf

setvbuf

_snprintf

_snprintf_s

_snprintf_l

_snprintf_s_l

_snscanf

_snscanf_s

_snscanf_l

_snscanf_s_l

_snwprintf

_snwprintf_s

_snwprintf_l

_snwprintf_s_l

_snwscanf

_snwscanf_s

_snwscanf_l

_snwscanf_s_l

_sopen

_sopen_s

_splitpath

_splitpath_s

sprintf

sprintf_s

_sprintf_l

_sprintf_s_l

sscanf

sscanf_s

_sscanf_l

_sscanf_s_l

strcat

strcat_s

strcpy

strcpy_s

_strdate

_strdate_s

strerror, _strerror

strerror_s, _strerror_s

_strlwr, _strlwr_l

_strlwr_s, _strlwr_s_l

strncat, _strncat_l

strncat_s, _strncat_s_l

strncpy, _strncpy_l

strncpy_s, _strncpy_s_l

_strnset

_strnset_s

_strnset_l

_strnset_s_l

_strset

_strset_s

_strset_l

_strset_s_l

_strtime

_strtime_s

strtok

strtok_s

_strtok_l

_strtok_s_l

_strupr, _strupr_l

_strupr_s, _strupr_s_l

swprintf

swprintf_s

_swprintf_l

_swprintf_s_l

swscanf

swscanf_s

_swscanf_l

_swscanf_s_l

tmpfile

tmpfile_s

_ui64toa, _ui64tow

_ui64toa_s, _ui64tow_s

_ultoa, _ultow

_ultoa_s, _ultow_s

_umask

_umask_s

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

vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l

_wasctime

_wasctime_s

_wcreat

_wsopen_s

wcrtomb

wcrtomb_s

wcscat

wcscat_s

wcscpy

wcscpy_s

_wcserror, __wcserror

_wcserror_s, __wcserror_s

_wcslwr, _wcslwr_l

_wcslwr_s, _wcslwr_s_l

wcsncat, wcsncat_l

wcsncat_s, _wcsncat_s_l

_wcsncpy, _wcsncpy_l

wcsncpy_s, _wcsncpy_s_l

_wcsnset, _wcsnset_l

_wcsnset_s, _wcsnset_s_l

wcsrtombs

wcsrtombs_s

_wcsset, _wcsset_l

_wcsset_s_wcsset_s_l

wcstok, _wcstok_l

wcstok_s, _wcstok_s_l

wcstombs, _wcstombs_l

wcstombs_s, _wcstombs_s_l

_wcsupr_l, _wcsupr

_wcsupr_s, _wcsupr_s_l

_wctime, _wctime32, _wctime64

_wctime_s, _wctime32_s, _wctime64_s

wctomb, _wctomb_l

wctomb_s, _wctomb_s_l

_wfopen

_wfopen_s

_wfreopen

_wfreopen_s

_wgetenv

_wgetenv_s

wmemcpy

wmemcpy_s

wmemmove

wmemmove_s

_wmktemp

_wmktemp_s

_wopen

_wsopen_s

_wscanf, _wscanf_l

_wscanf_s, _wscanf_s_l

_wsearchenv

_wsearchenv_s

_wsopen

_wsopen_s

_wsplitpath

_wsplitpath_s

_wstrdate

_wstrdate_s

_wstrtime

_wstrtime_s

Functions with Secure Template Overloads




----------------------------------------------------------
다른 참조할 만한 링크
Security Enhancements in the CRT(C Run-Time Libraries)
 
http://msdn2.microsoft.com/en-us/library/8ef0s5kh(VS.80).aspx
Comments