|
-
Oct 5th, 2005, 10:05 AM
#1
[RESOLVED] [MASM] Clarification about Symbolic Constants
Theres an ambiguous part in a book I'm reading about MASM, I won't quote it here but tell me how the following code behaves...
Code:
NUMBER = 20 ;does this really mean 5?
mov eax, NUMBER
NUMBER = 5
mov ebx, NUMBER
add eax, ebx
I inferred from the book that the very last instance of ...
... propagates through the whole file rendering all of the other instances useless. Is this right?
If this is the case then eax now contains 10 (5+5). But my own mind makes me think that it would actually contain 25.
I know how things like this behave in other languages and they way the book says it sounds weird.
Can anyone shed any light?
(I would try it but I haven't got MASM on this machine)
Last edited by wossname; Oct 5th, 2005 at 10:09 AM.
I don't live here any more.
-
Oct 5th, 2005, 10:21 AM
#2
Re: [MASM] Clarification about Symbolic Constants
the final result must be 25..........i checked in the inline assembler of C++!!!
Code:
NUMBER = 20 ;does this really mean 5?
it means that NUMBER now contains 20!!!
If this is the case then eax now contains 10 (5+5).
how you mean by this???? 
if that statement is related to this one then here eax will contain 25, 20 from the first mov stment then adding BX = 5 to it.........adding upto 25!!!
-
Oct 5th, 2005, 10:47 AM
#3
Re: [MASM] Clarification about Symbolic Constants
"The assignment to symbolic constants has nothing to do with the order of the lines of code"
is roughly what the book says, looks like I've been thinking the same thing as you said.
-
Oct 6th, 2005, 03:20 AM
#4
Re: [MASM] Clarification about Symbolic Constants
Nevermind it is 25 after all
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|