473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

arithmetic on __gc pointer

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[i] = something;

Thanks :) Toke Jansen
Nov 17 '05 #1
4 1161
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 :)

mphanke wrote:
Hi,

I guess waht you want to do is:

some_object->array->Item[i] = 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[i] = something;

Thanks :) Toke Jansen

Nov 17 '05 #2
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 :)

mphanke wrote:
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;
}

TJH wrote:
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 :)

mphanke wrote:
Hi,

I guess waht you want to do is:

some_object->array->Item[i] = 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[i] = something;

Thanks :) Toke Jansen

Nov 17 '05 #3
mphanke wrote:
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.

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #4
SFX
How about:

chart1->Value[0][0] = 30;

How are you importing the control into vc ?

--
FP
Software FX
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Edward Diener | last post by:
In the documentation for a __gc pointer, this explanation occurs: "A __gc pointer to an object of __value class type can either point into the stack or into the common language runtime heap. The...
3
by: | last post by:
this->user_information->Text = this->query->SList; sList is a SortedList i want to reach its valur by its index ??? i got this error error C2845: '[' : cannot perform pointer arithmetic on...
1
by: Bern McCarty | last post by:
I am using MEC++ in VC 7.1. I had a method on a __gc object that looked like this: __property System::UInt32 get_MyProperty(void) { System::Byte __pin * pinBytes = &m_byteArray; // entire...
2
by: microsoft | last post by:
Hi All, I am fairly new to Managed C++ extensions. I started trying to implement a interface defined in a C# project, in C++. The problem was with passing value arrays from c# to c++. I found...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.