News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Error messages given from using different equates (EQU and =)

Started by StillLearningMasm, March 15, 2022, 01:22:17 PM

Previous topic - Next topic

_japheth

Quote from: StillLearningMasm on March 18, 2022, 09:00:41 AM
Why do i not get a symbol redefinition error for both of them?

Because the lines are handled differently.  :bgrin:
The angle brackets tell EQU that anything that follows must not be interpreted. As for the other case, masm is intelligent enough to translate the "2" to the hex value 032h - a valid number.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

StillLearningMasm

#16
Thanks again _japheth

I am SLOWLY starting to have a understanding of the equates, I think

in this program fragment:
cseg segment

start:
.386

rr equ <v>
;other code
rr = 1  ; no error

;other code
cseg ends
end start

No error occurs.

But if I change it to this:

cseg segment

start:
.386

rr equ <>
;other code
rr = 1  ; syntax error

;other code
cseg ends
end start

Why do I get a syntax error?
According to the documentation for EQU with a <>:
This form can be any text in <>.  Same name can be used to redefine this form.

jj2007

rr equ <>
;other code
rr equ <1>  ; no error


Accept that the documentation is not perfect, and that Masm has its quirks.

If you need changing numeric constants, use number=123
If you need non-number constants, use equ.