Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Mengambil atau memodifikasi ambang batas yang mengontrol perilaku pengisian buffer dalam fungsi debug.
Sintaksis
size_t _CrtSetDebugFillThreshold( size_t newThreshold );
Parameter-parameternya
newThreshold
Ukuran ambang batas baru dalam byte.
Mengembalikan nilai
Nilai ambang batas sebelumnya.
Komentar
Versi debug dari beberapa fungsi CRT yang ditingkatkan keamanan mengisi buffer yang diteruskan kepada mereka dengan karakter khusus (0xFE). Karakter isian ini membantu menemukan kasus di mana ukuran yang salah diteruskan ke fungsi. Sayangnya, itu juga mengurangi performa. Untuk meningkatkan performa, gunakan _CrtSetDebugFillThreshold untuk menonaktifkan pengisian buffer untuk buffer yang lebih besar dari newThreshold ambang batas.
newThreshold Nilai 0 menonaktifkannya untuk semua buffer.
Ambang batas defaultnya adalah SIZE_T_MAX.
Berikut daftar fungsi yang terpengaruh:
-
asctime_s,_wasctime_s -
_cgets_s,_cgetws_s -
ctime_s, ,_ctime32_s_ctime64_s,_wctime_s, ,_wctime32_s,_wctime64_s _ecvt_s_fcvt_s_gcvt_s-
_itoa_s, ,_ltoa_s,_ultoa_s_i64toa_s_ui64toa_s_itow_s, ,_ltow_s_ultow_s_i64tow_s_ui64tow_s -
_makepath_s,_wmakepath_s -
_mbsnbcat_s,_mbsnbcat_s_l -
_mbsnbcpy_s,_mbsnbcpy_s_l -
_mbsnbset_s,_mbsnbset_s_l -
_mktemp_s,_wmktemp_s -
_splitpath_s,_wsplitpath_s -
strcat_s, ,wcscat_s_mbscat_s -
strcpy_s, ,wcscpy_s_mbscpy_s -
_strdate_s,_wstrdate_s -
strerror_s, ,_strerror_s_wcserror_s,__wcserror_s -
_strlwr_s, ,_strlwr_s_l_mbslwr_s,_mbslwr_s_l, ,_wcslwr_s,_wcslwr_s_l -
strncat_s, ,_strncat_s_lwcsncat_s,_wcsncat_s_l, ,_mbsncat_s,_mbsncat_s_l -
strncpy_s, ,_strncpy_s_lwcsncpy_s,_wcsncpy_s_l, ,_mbsncpy_s,_mbsncpy_s_l -
_strnset_s, ,_strnset_s_l_wcsnset_s,_wcsnset_s_l, ,_mbsnset_s,_mbsnset_s_l -
_strset_s, ,_strset_s_l_wcsset_s,_wcsset_s_l, ,_mbsset_s,_mbsset_s_l -
_strtime_s,_wstrtime_s -
_strupr_s, ,_strupr_s_l_mbsupr_s,_mbsupr_s_l, ,_wcsupr_s,_wcsupr_s_l -
vsnprintf_s, ,_vsnprintf_s_vsnprintf_s_l, ,_vsnwprintf_s,_vsnwprintf_s_l
Persyaratan
| Rutin | Header yang diperlukan |
|---|---|
_CrtSetDebugFillThreshold |
<crtdbg.h> |
Fungsi ini khusus Microsoft. Untuk informasi kompatibilitas selengkapnya, lihat Kompatibilitas.
Perpustakaan
Hanya men-debug versi pustaka run-time C .
Contoh
// crt_crtsetdebugfillthreshold.c
// compile with: cl /MTd crt_crtsetdebugfillthreshold.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <crtdbg.h>
void Clear( char buff[], size_t size )
{
for( int i=0; i<size; ++i )
buff[i] = 0;
}
void Print( char buff[], size_t size )
{
for( int i=0; i<size; ++i )
printf( "%02x %c\n", (unsigned char)buff[i], buff[i] );
}
int main( void )
{
char buff[10];
printf( "With buffer-filling on:\n" );
strcpy_s( buff, _countof(buff), "howdy" );
Print( buff, _countof(buff) );
_CrtSetDebugFillThreshold( 0 );
printf( "With buffer-filling off:\n" );
Clear( buff, _countof(buff) );
strcpy_s( buff, _countof(buff), "howdy" );
Print( buff, _countof(buff) );
}
With buffer-filling on:
68 h
6f o
77 w
64 d
79 y
00
fe ■
fe ■
fe ■
fe ■
With buffer-filling off:
68 h
6f o
77 w
64 d
79 y
00
00
00
00
00