Current state of pointers in structs

Started by Monsieur OUXX, 03 Sep 2021, 15:38

« previous - next »

Monsieur OUXX

As far as I can see, in AGS 3.6.0.8 (patch9) : (September 2021)


This works and it's really cool :
Code: ags

managed struct A {  // <-- MANAGED
  int i;
};

struct B {  // <-- NOT MANAGED
  A* a; // <-- Pointer to managed.
};



This works and it's really cool too:
Code: ags
managed struct A
{
  int i;
};


struct B{
  A* array[];
};

Later :
Code: ags

   B b;
   b.array = new A[10];
   b.array[0] = new A;
   b.array[0].i= 666;



This does NOT work :
Code: ags

struct A {  // <-- NOT MANAGED
  int i;
};

struct B {  // <-- NOT MANAGED
  A a; // <-- Compiler error! Non-managed inside struct.
};


This does NOT work :
Code: ags

managed struct A {  // <-- MANAGED
  int i;
};

managed struct B {  // <-- MANAGED
  A* a; // <-- Compiler error! Pointer to managed inside a managed.
};


Correct?
 

Alan v.Drake

You should also try the AGS4 branch with the "Use extended script compiler" turned on in General Settings.
All the cool new stuff is coming there, ferne also prepared a commit to make import functions work no matter the order (not yet merged).

- Alan

Monsieur OUXX

Quote from: Alan v.Drake on 04 Sep 2021, 03:49
You should also try the AGS4 branch, all the cool new stuff is coming there.

Hm. I hear you, but you sounded like you were replying "in general" rather than specifically stating that the examples I described above are now possible.
I don't want to switch to AGS4 just to discover that there's a lot of new cool stuff, just other cool stuff, not this.
 

Crimson Wizard

Nothing has changed since AGS 3.4.0 in this regard. All of the above is correct (although example #3 is not related to the pointer problem).

SMF spam blocked by CleanTalk