can't display multi-arrays variable in watch window!

T

Tau

look my simple code below(vc8):

double ends[2][3];
ends[0][2]=8.3;

when i debug it, the variable ends[0][2] cannot be displayed in the
watch window.
it just said "error: index '0' out of bound for pointer/array 'ends'".
why would this happen? Is it a bug of VC8?

Thanks in advance!
 
B

Bruno van Dooren

you have to show us the context of your example.
a watch window can only show you global variables, and variables that are
currently in scope.

in the following example i have added ends[0][2] to my watch window. i only
get a value there as long
as i am debugging the function 'testje'. as soon as the debugger steps out
of that function, i get an error in my watch
window because the current scope does not see the variable 'ends'.

other than that, quickwatch and the watch window work fine with the code
example you supplied.

#include "stdafx.h"

void testje(void)
{
double ends[2][3];
ends[0][2]=8.3;
}

int _tmain(int argc, _TCHAR* argv[])
{
testje();
return 0;
}

kind regards,
Bruno.
 
T

Tau

Sorry for my not describe the problem correctly...
my project is based on C++/CLI and using VS2005

it cannot display in watch window...

// MyCppCLI.cpp : main project file.

#include "stdafx.h"

using namespace System;


int main(array<System::String ^> ^args)
{
double ends[2][3];
ends[0][2] = 8.3;
return 0;
}
 
B

Bruno van Dooren

bizarre. it seems to work fine for 1 dimensional arrays.
i think this is a bug.

kind regards,
Bruno.
 
T

Tau

I tried this with VS2003 and Managed C++, it has errors too.
This bug has been existing for such a long time and no one find out?
strange....
Maybe we should email to Bill? :)
 
S

segmentation_fault

This might help:

The C++ expression evaluator uses C#-style syntax for multidimensional
arrays. For example:

c[0,0]

Using normal C++ syntax generates an error:

c[0][0] error: index '0' out of bound for pointer/array 'c'

Its just a result of efforts of MS to make c# as a monopolic PL. :)


*look my simple code below(vc8):

double ends[2][3];
ends[0][2]=8.3;

when i debug it, the variable ends[0][2] cannot be displayed in the
watch window.
it just said "error: index '0' out of bound for pointer/array
'ends'".
why would this happen? Is it a bug of VC8?

Thanks in advance! *
 
T

Tau

It still cannot work...
see the result:

ends[0,0] {Length=0} double[]
ends[0,1] {Length=0} double[]
ends[0,2] error: index '0,2' out of bound for pointer/array 'ends'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top