Just starting out? Need help? Post your questions and find answers here.
-
gurj
- Enthusiast
- Posts: 664
- Joined: Thu Jan 22, 2009 3:48 am
- Location: china
-
Contact:
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
-
skywalk
- Addict
- Posts: 3999
- Joined: Wed Dec 23, 2009 10:14 pm
- Location: Boston, MA
Post
by skywalk »
Not a bug. You are comparing 2 pointers to the structures LeftPoint and RightPoint.
They are not equal.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
gurj
- Enthusiast
- Posts: 664
- Joined: Thu Jan 22, 2009 3:48 am
- Location: china
-
Contact:
Post
by gurj »
for Structure Variables content , now can use :
a=b
can't use :
If a=b ;and <>,>,<,>=,<=
-
mk-soft
- Always Here
- Posts: 5405
- Joined: Fri May 12, 2006 6:51 pm
- Location: Germany
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
-
gurj
- Enthusiast
- Posts: 664
- Joined: Thu Jan 22, 2009 3:48 am
- Location: china
-
Contact:
Post
by gurj »
@skywalk:
if is pointers, best use @
@mk-soft:thanks!
-
skywalk
- Addict
- Posts: 3999
- Joined: Wed Dec 23, 2009 10:14 pm
- Location: Boston, MA
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
-
gurj
- Enthusiast
- Posts: 664
- Joined: Thu Jan 22, 2009 3:48 am
- Location: china
-
Contact:
Post
by gurj »
@skywalk:thanks!
I not like to has 'x = @x'