次の方法で共有


_CrtSetDebugFillThreshold

を取得またはデバッグ機能の制限を制御するバッファーへの動作を変更します。

size_t _CrtSetDebugFillThreshold(
   size_t _NewThreshold
);

パラメーター

  • newThreshold
    新しいしきい値。

戻り値

前のしきい値。

解説

一部のデバッグ バージョンはセキュリティが強化された CRT 関数の特殊文字 (0xFD) で渡されたバッファーに格納します。これにより不適切なサイズが関数に渡されたケースを検索できます。ただしパフォーマンスが低下します。パフォーマンスを向上させるためにしきい値よりも大きい場合にバッファーに格納するバッファーを無効にするに _CrtSetDebugFillThreshold を使用します。0 のしきい値はすべてのバッファーのビューステートを無効にします。

既定のしきい値は SIZE_T_MAX です。

影響を受ける関数の一覧を示します。

必要条件

ルーチン

必須ヘッダー

_CrtSetDebugFillThreshold

<crtdbg.h>

互換性の詳細については、「C ランタイム ライブラリ」の「互換性」を参照してください。

ライブラリ

C ランタイム ライブラリのデバッグ バージョンのみ。

使用例

// crt_crtsetdebugfillthreshold.cpp
// compile with: /MTd
#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
fd  ²
fd  ²
fd  ²
fd  ²
With buffer-filling off:
68  h
6f  o
77  w
64  d
79  y
00
00
00
00
00

同等の .NET Framework 関数

該当なし標準 C 関数を呼び出すには、PInvoke を使用します。詳細については、「プラットフォーム呼び出しの例」を参照してください。

参照

関連項目

デバッグ ルーチン