arithmetic on __gc pointer

T

TJH

hi there

im new to develop in .net, and i keep getting this compiler error
"cannot perform pointer arithmetic on __gc pointer" when i try:
some_object->array = something;

Thanks :) Toke Jansen
 
T

TJH

Thanks Martin
That works, but only for 1D arrays, what about 2D. The Item function
only takes 1 argument...

what im trying to do is this: chart1->Value[0,0] = 30;

Thanks agian :)
Hi,

I guess waht you want to do is:

some_object->array->Item = something;

Actually I expected the otherthing to work to, but for some reason it
didn't for me. But the above works.

This should help,

Martin

hi there

im new to develop in .net, and i keep getting this compiler error
"cannot perform pointer arithmetic on __gc pointer" when i try:
some_object->array = something;

Thanks :) Toke Jansen
 
T

TJH

yeah, that works if i create my own class like you just did... the
problem is that im trying to use the chartfx for .net, so i havn't
defined the class by my self... i can not find anything about using
chartfx in vc on the web... I dont know if it is the compiler which is
buggy?
It works perfect in C#, but i have some native c++ code which i need to
reuse... maybe to much to ask, but could you tell me what to do ;)

Thanks agian for your help Martin :)
Hi,

this snippet works for me (console hack for you):
[BTW: Have you initialized the Array?]

public __gc class testClass
{
public:
int Value[,];

testClass()
{
Value = new int __gc [10,10];
}
};

int _tmain()
{
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello World");

testClass *tc = new testClass();

for(int i=0; i<10; i++)
for(int j=0; j<10; j++)
tc->Value[i,j] = rand();

for(int i=0; i<10; i++)
for(int j=0; j<10; j++)

Console::WriteLine(String::Format("Value[{0:00},{1:00}]={2}", __box(i),
__box(j), __box(tc->Value[i,j])));

Console::Read();
return 0;
}
Thanks Martin
That works, but only for 1D arrays, what about 2D. The Item function
only takes 1 argument...

what im trying to do is this: chart1->Value[0,0] = 30;

Thanks agian :)
Hi,

I guess waht you want to do is:

some_object->array->Item = something;

Actually I expected the otherthing to work to, but for some reason it
didn't for me. But the above works.

This should help,

Martin


TJH wrote:

hi there

im new to develop in .net, and i keep getting this compiler error
"cannot perform pointer arithmetic on __gc pointer" when i try:
some_object->array = something;

Thanks :) Toke Jansen
 
B

Brandon Bray [MSFT]

mphanke said:
I stumbled over the following sentence all the time: C# & VB. This kinda
gives me the felling this is intended for use in this to langs only. The
other thing I found was the ListProvider in ChartFx.Data. I guess you
have to use this thingy there somehow.

This was one of the primary motivations behind redesigning the C++ language
in the Visual C++ 2005 release. Indexers will work just like they do in C#
and other languages, and the problems seen in this thread are syntactically
avoided.

Of course, that's in beta now... so it's good that you were able to work
around the problems in the old syntax.
 

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