Hi Hutch, why do You use equ but do not '=' ???
sorry, i'm fake hutch:=
Assigns the numeric value of expression to name.
name = expression
Remarks
The symbol can be redefined later.
equ
The first directive assigns numeric value of expression to name.
name equ expression
name equ <text>
Remarks
The name cannot be redefined later.
The second directive assigns specified text to name. The name can be assigned a different text later. See TEXTEQU.
so, they must be different.
EQU cannot be re-assigned (except TEXTEQU, which can be)
= can be re-assigned
blah = 1
mov eax,blah ;eax = 1
blah = 9
mov eax,blah ;eax = 9
if you try that with EQU, i think it throws a multiple definition assembly error
by using EQU in windows.inc, it prevents programmers from accidently changing the values
:bg
Yurp !
Quote from: dedndave on February 07, 2010, 12:13:05 PM
EQU cannot be re-assigned (except TEXTEQU, which can be)
= can be re-assigned
blah = 1
mov eax,blah ;eax = 1
blah = 9
mov eax,blah ;eax = 9
if you try that with EQU, i think it throws a multiple definition assembly error
by using EQU in windows.inc, it prevents programmers from accidently changing the values
To accidently change predefined value with asm- programming is lol :) (They are well known)
To prevent a change everyone can use IFDEF/IFNDEF.
> EQU cannot be re-assigned
So says the manual. Try your luck:
include \masm32\include\masm32rt.inc
mac1 MACRO
test1 equ <ciao>
% echo test1
test1 equ <hello>
% echo test1
ENDM
.code
start:
mac1
test2 equ <ciao #2>
% echo test2
test2 equ <hello #2>
% echo test2
getkey
exit
end start
The actual statement (from the Version 6.0 manual, emphasis added):
Quote
The difference between EQU and = is that integers defined with the = directive can be changed in your source code, but those defined with EQU cannot.
i think this is essentially a TEXTEQU
test1 equ <ciao>
(Warning A0C1A0: Beware of Germans speaking Italiano :P )
For short, It is just Hutch wish as autor.
But = is short then equ, and you can change it by youself.
Rockphorr,
No, its a safety design issue, equ makes the equate reliable where = is not for equates. They are different so that you can write different code that does different things.
Quote from: hutch-- on February 08, 2010, 08:10:23 PM
Rockphorr,
No, its a safety design issue, equ makes the equate reliable where = is not for equates. They are different so that you can write different code that does different things.
Give me please a samle to show it.
I think that these constants are use to mov to reg and push to stack.
For this purporse the safety is not important.
Why do everyone change it ???
Rockphorr,
Just check the MASM reference material, an equate is a non-changing value and is properly written using the EQU notation so that it cannot be changed. MASM has both notations so you can do different things, equates are fixed where assigned values can be changed, just pick the capacity you need.
Quote from: Rockphorr on February 09, 2010, 01:51:18 PM
Why do everyone change it ???
Imagine you have two different include files, windows.inc and MyExotic.inc. They both define SOME_EXOTIC_VALUE = 123h
For Masm 11.0, Hutch corrects a mistake, and now SOME_EXOTIC_VALUE = 124h. Since there are many exotic values to be corrected, he will not inform you about each and every one.
And one day, your 10,000 lines code starts behaving strangely. Can you imagine how difficult it will be to find out why? With SOME_EXOTIC_VALUE EQU 123h, you would just get an error message, and comment the one in MyExotic.inc to fix the problem.
Quote from: hutch-- on February 09, 2010, 02:25:42 PM
Rockphorr,
Just check the MASM reference material, an equate is a non-changing value and is properly written using the EQU notation so that it cannot be changed. MASM has both notations so you can do different things, equates are fixed where assigned values can be changed, just pick the capacity you need.
Ok. Are equs in windows.inc required ? I think you do it to make more simply a learning masm.
Beginners some time do something that we can not imagine.
Quote from: jj2007 on February 09, 2010, 02:36:57 PM
Quote from: Rockphorr on February 09, 2010, 01:51:18 PM
Why do everyone change it ???
Imagine you have two different include files, windows.inc and MyExotic.inc. They both define SOME_EXOTIC_VALUE = 123h
I always do not define double definitions. Every defenition is in windows.inc XOR in MyExotic.inc