Microsoft KB Archive/50712

= DOC: Run-Time Routines Assume Direction Flag Is Clear in C =

Article ID: 50712

Article Last Modified on 12/12/2003

-

APPLIES TO

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

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.0 Professional Edition

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

 Microsoft Visual C++ 2.1</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

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

 Microsoft Visual C++ 6.0 Service Pack 5</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q50712

<div class="summary_section">

SUMMARY
The C run-time routines assume that the direction flag is cleared. If you are using other functions with the C run-time functions, you must ensure that the other functions leave the direction flag alone or restore it to its original condition. Expecting the direction flag to be clear upon entry makes the run-time code faster and more efficient. The direction flag is a CPU flag specific to Intel 80x86 processors. It applies to all assembly instructions that use the REP (repeat) prefix, such as MOVS, MOVSD, MOVSW, etc. Addresses provided to applicable instructions are increased if the direction flag is cleared.

The CRT function, such as the string manipulation and buffer manipulation routines, expect the direction flag to be clear. This is usually the case and is documented in the &quot;Microsoft Macro Assembler Programmer's Guide,&quot; for versions 5.0 and 5.1, as follows: Under DOS, the direction flag will normally be cleared if your program has not changed it.

Additional query words: kbCRT kbOLDocs kbVC100 kbVC150 kbVC200 kbVC210 kbVC400 kbVC500 kbDSupport

Keywords: kbdocerr KB50712

-

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

© Microsoft Corporation. All rights reserved.