Microsoft KB Archive/166946

= FIX: Match Brace Command Foiled by String/Character Literals =

Article ID: 166946

Article Last Modified on 8/12/2005

-

APPLIES TO


 * Microsoft Visual Studio 97 Service Pack 3
 * Microsoft Visual Studio 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition
 * Microsoft Visual J++ 1.1 Standard Edition
 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q166946



SYMPTOMS
The matching brace feature of the Text Editor (the GoToMatchBrace and GoToMatchBraceExtend commands) fails if code contains curly braces ({}), square brackets ([]), angle brackets (<>), or parentheses as literals. For example:

void test {    TCHAR szBar[] = _T("{"); TCHAR chBar = _T('{'); }

If you position the caret before the first brace and then execute the GoToMatchBrace command, nothing happens.



CAUSE
The editor keeps a count of the brace (or other character) it is trying to match as it scans the code. It does not recognize language tokens, so it cannot skip strings.



RESOLUTION
You can work around this by coding the brace (or other character) using an octal or hex escape sequence, instead of a literal. For example:

"{"

could be written:

"\x7B"



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.

Keywords: kbbug kbfix kbnoupdate kbide KB166946

-

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

© Microsoft Corporation. All rights reserved.