OK, call me suspicious...

Everything else that doesn't fall into one of the other PB categories.
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

OK, call me suspicious...

Post by dmoc »

...this works! 8O 8O

What's the point of the post? Earlier PB versions had a problem getting address of a structured variable inside a structure. Now thats ok (as the first part of the code below shows) but I've just discovered (see second part of code) that we can now use pointer vars in structures declared as pointers and useable without the "*" (contrary to many many previous postings). I'm suspicious that this is an unofficial "feature" or something. Can anyone (pref Fred) confirm that this behaviour is as designed and will remain in future PB versions?

Code: Select all

Structure strA
  r.f
  g.f
  b.f
EndStructure

Structure strB
  n.l
  c.strA
  x.l
  *p.strA
EndStructure

objA.strA
objB.strB

Debug "Sub-structure Addressing"
Debug "========================"
Debug ""
Debug "Should be same)..."
Debug ""
Debug "    @objB\c   = "+Str(@objB\c)
Debug "    @objB\c\r = "+Str(@objB\c\r)
Debug ""

Debug "Structure Pointers in Structures"
Debug "================================"
Debug ""
Debug "objA\r should be set via objB ptr..."
Debug ""
objA\r = 0
Debug "objA\r   = "+Str(objA\r)+" (before)"
objB\p = @objA
objB\p\r = 999 ; <<< Look ma, no star!
Debug "@objA    = "+Str(@objA)
Debug "objB\p   = "+Str(objB\p)
Debug "objB\p\r = "+Str(objB\p\r)
Debug "objA\r   = "+Str(objA\r)+" (after)"
Debug ""
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

I believe this is intended... I've been using pointers-to-structures in structures that way for some time...
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

I realised after posting it's prob to do with the recent com/dx stuff. It's not clear from the help though.
Post Reply