Microsoft KB Archive/142420

= DOC: Setdflag.c Sample for _CrtSetDbgFlag Missing Tilde (~) =

Article ID: 142420

Article Last Modified on 12/9/2003

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription

 Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q142420

<div class="summary_section">

SUMMARY
The Setdflag.c sample program in the Help under _CrtSetDbgFlag, contains the following section of code which is missing a tilde (~) character: /* tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); tmpDbgFlag |= _CRTDBG_ALLOC_MEM_DF; tmpDbgFlag &= _CRTDBG_DELAY_FREE_MEM_DF; // This line is wrong _CrtSetDbgFlag(tmpDbgFlag); The third line of code should be: tmpDbgFlag &= ~_CRTDBG_DELAY_FREE_MEM_DF;
 * Set the debug-heap flag to no longer keep freed blocks in the
 * heap's linked list and turn on Debug type allocations (CLIENT)

<div class="moreinformation_section">

MORE INFORMATION
To disable a flag with the _CrtSetDbgFlag function, you should AND the variable with the bitwise NOT of the bitmask.

Additional query words: kbVC400bug

Keywords: kbcrt kbdocerr KB142420

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.