BUG: Match Brace Command Foiled by String/Character Literals

Last reviewed: July 21, 1997
Article ID: Q166946
The information in this article applies to:
  • Microsoft Visual Studio 97
  • Microsoft Visual C++, 32-bit Editions, version 5.0
  • Microsoft Visual J++, version 1.1
  • Microsoft Visual InterDev, version 1.0

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. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.


Keywords : vcbuglist500 VWBIss
Version : 1.1 1.0 5.0 97
Platform : NT WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.