Microsoft KB Archive/168430

= FIX: Using Referenced Integer to Access Array Generates CXX0034 =

Article ID: 168430

Article Last Modified on 12/2/2003

-

APPLIES TO

 The Integrated Debugger, 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++ 5.0 Enterprise Edition</li></ul>

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

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

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

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

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

-

<div class="notice_section">

This article was previously published under Q168430

<div class="symptoms_section">

SYMPTOMS
The Visual C++ debugger generates the following error while using a referenced integer to access array.

Error: CXX0034: types incompatible with operator

The MORE INFORMATION section below contains a sample showing this behavior.

<div class="resolution_section">

RESOLUTION
The workaround is not to use referenced integer a[i] to access array as shown in the sample. Use index value instead, as a[1].

<div class="status_section">

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.

<div class="moreinformation_section">

Steps to Reproduce Behavior
Build the following sample with debug information: //test.cpp int func(int& i, int a[]) {     return 0; }

int main(void) {    int a[] = {1, 2, 3}; int i = 1; func(i, a);// SET A BREAKPOINT HERE return 0; }

Start the debugger with a breakpoint shown. If you now step into func by hitting the F11 key and put a watch on "a[i]," you will get the error mentioned above. However, evaluating "i" and "a[1]" works just fine.

Keywords: kberrmsg kbbug kbfix kbnoupdate kbide kbdebug KB168430

-

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

© Microsoft Corporation. All rights reserved.