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 4 1174
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
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::WriteL ine(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::WriteL ine(String::For mat("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
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.
How about:
chart1->Value[0][0] = 30;
How are you importing the control into vc ?
--
FP
Software FX This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 latter can occur if an
object of a __value class object is embedded in an object of a __gc class."
I do not understand how a __gc pointer to an object of __value class can
point into the stack. Would someone please give me an example of this ?
|
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 __gc pointer
'System::Collections::SortedList __gc *'
|
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 array is
now pinned
NativeStruct const __nogc* nativeStructP = reinterpret_cast<NativeStruct
const __nogc*>(pinBytes);
|
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 examples on the web which worked, but
found mine didn't. After narrowing down the interface I found what I believe
to be the problem. The order of the parameters! The code below shows the
function that does not compile named QueryPositionsForward....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |