is a bug?: if Structure Variables use "="

Just starting out? Need help? Post your questions and find answers here.
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

is a bug?: if Structure Variables use "="

Post by gurj »

Code: Select all

;is a bug?: if Structure Variables use "="

Structure MyPoint
 x.l 
 y.l
EndStructure

LeftPoint.MyPoint\x = 10
LeftPoint\y = 20

RightPoint.MyPoint = LeftPoint

Debug RightPoint\y
Debug "---------"

If RightPoint<>LeftPoint:Debug "is a bug?"
 Else:Debug "no bug?"
EndIf
my pb for chinese:
http://ataorj.ys168.com
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: is a bug?: if Structure Variables use "="

Post by skywalk »

Not a bug. You are comparing 2 pointers to the structures LeftPoint and RightPoint.
They are not equal. :idea:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: is a bug?: if Structure Variables use "="

Post by gurj »

for Structure Variables content , now can use :
a=b
can't use :
If a=b ;and <>,>,<,>=,<=
my pb for chinese:
http://ataorj.ys168.com
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: is a bug?: if Structure Variables use "="

Post by mk-soft »

Only without strings, arrays, lists

Code: Select all

Structure MyPoint
    x.l 
    y.l
  EndStructure
  
  LeftPoint.MyPoint\x = 10
  LeftPoint\y = 20
  
  RightPoint.MyPoint = LeftPoint
  
  Debug RightPoint\y
  Debug "---------"
  
  If CompareMemory(RightPoint, LeftPoint, SizeOf(MyPoint))
    Debug "Ok"
  Else
    Debug "False"
  EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: is a bug?: if Structure Variables use "="

Post by gurj »

@skywalk:
if is pointers, best use @
@mk-soft:thanks!
my pb for chinese:
http://ataorj.ys168.com
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: is a bug?: if Structure Variables use "="

Post by skywalk »

gurj wrote:@skywalk:
if is pointers, best use @
There is no if. The structure variable = @structure variable.

Code: Select all

Define.POINT x,y
x\x = 1
y\y = 2
y = x
Debug Bool(x = @x)
There is no deep memory compare function for complex structures. You must code that.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: is a bug?: if Structure Variables use "="

Post by gurj »

@skywalk:thanks!
I not like to has 'x = @x'
my pb for chinese:
http://ataorj.ys168.com
Post Reply