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!
Bruno van Dooren - 11 Jan 2006 09:21 GMT
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.
> look my simple code below(vc8):
>
[quoted text clipped - 7 lines]
>
> Thanks in advance!
Tau - 11 Jan 2006 10:25 GMT
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;
}
Bruno van Dooren - 11 Jan 2006 11:09 GMT
bizarre. it seems to work fine for 1 dimensional arrays.
i think this is a bug.
kind regards,
Bruno.
> Sorry for my not describe the problem correctly...
> my project is based on C++/CLI and using VS2005
[quoted text clipped - 13 lines]
> return 0;
> }
Tau - 12 Jan 2006 02:29 GMT
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? :-)
segmentation_fault - 16 Mar 2006 22:43 GMT
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):
>
[quoted text clipped - 8 lines]
>
> Thanks in advance! *
Tau - 28 Mar 2006 02:54 GMT
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'