Re: MODULE: Stack v2.0 - Vectorized generic stacks - Updated 25 January 2015

Started by ollj, Wed 22/07/2015 19:50:21

Previous topic - Next topic

ollj

i made the misttake to just assume that this, and things like this. would also work in version 3.4.0.5. without a null pointer on runtime, but they dont, leaving this to v 3.4.0.3 i guess. so, what went bad in 3.4.0.5, throwing null pointers on managed structs beiing read or written in in any other structs function?

possibly i initialized it wrongly? no, i tested my own minimal basic managed structs and very simple getter functions, and keep getting null pointers. maybe i am missing someting essential with managed structs?

stuff as simple as
Code: ags

managed struct Managedstruct{ 
int x;
}
struct containsmanagedstruct{
  Managedstruct value;
import ManagedstructGet();
}

void containsmanagedstruct::ManagedstructGet(){
  ms; ms= new Managedstruc;
  int i = this.Managedstruct.x; //gets me a null pointer
}


Khris

QuoteImportant: Managed structs are currently VERY limited in that they can't contain pointers (including dynamic arrays).
This code of yours won't even compile like that, not even if one fixed the syntax errors.

Also, why was this posted here? Was does any of this have to do with the Stack module...?

Crimson Wizard

E: well, Khris replied faster and shorter.

Ollj, can you please explain, how your question is related to the Stack Module? Why on Earth do you keep posting in wrong threads?

@Moderators, I believe this question and replies should be moved into Editor Development.

Quote from: ollj on Wed 22/07/2015 19:50:21
stuff as simple as
Code: ags

void containsmanagedstruct::ManagedstructGet(){
  ms; ms= new Managedstruc;
  int i = this.Managedstruct.x; //gets me a null pointer
}

The code you display here makes zero sense. I doubt it would even compile in AGS. If it does, then there's something wrong with compiler.
First, where is the declaration of "ms"? Did you just leave it out when posting here?
Second, what is "this.Managedstruct.x"? "x" is not a static member of Managedstruct, therefore you cannot reference it without real instance. And Managedstruct is not a member of containsmanagedstruct.
According to the code you posted, there is "value" variable of type Managedstruct inside containsmanagedstruct, but in your example you are initializing some "ms".
If its really what you do in your actual script, then there is no wonder the member "value" of "containsmanagedstruct" is still "null".

Ollj, you keep mentioning C language, which makes me think you programmed with it. I am baffled how someone who programs can post such non-sensical code, and post in old and/or unrelated threads so often.

SMF spam blocked by CleanTalk