Are equates and constants the same thing. If not what is an equate and why are the defined in windows.ini.

Thanks,

Simon.
Posted on 2002-10-24 18:58:57 by SNDHearn
Hi there SNDHearn,
Well yeah, equates and constants are basically the same thing. I could be wrong but I don't think there is another mnemonic for constant. The reason we use equ in windows.inc and other files is that they can't be changed at run time because the assembler replaces equates you use throughout your code with what it is defined as. It's like a tag that get replaced and can't be changed back without another recompile.

You could use db, dd, etc to define vars which you could call as constants but there would be no point, not only does it occupy memory but it can be changed at run time which may not be desired is situations.

James:alright:
Posted on 2002-10-24 20:20:50 by JamesE
thanks mate, just wanted to clear that up.

Simon.

:alright:
Posted on 2002-10-24 22:26:33 by SNDHearn
If i am not wrong, for contants you can redefine it. However for equates, you cannot redefine it. So window.inc mainly use equ for the commonly used values.
Posted on 2002-10-25 08:07:20 by roticv
const takes memory and room in the executable, equates are preprocessed:

it is the equivalent of the C #define...
Posted on 2002-10-25 08:25:14 by JCP
hmm, so you can redefine constants and they take up memory, sounds more like a variable. I dunno im new to this. What are variables called in Win32 progrtamming, DB DD etc?.

Simon.
Posted on 2002-10-25 10:15:02 by SNDHearn
Data put in the CONST segment is read only, so cannot be changed.
CONST segment

db "Windows won't let you change me...",0
dd 0DEADBEEFh ; constant
REAL4 0.235813
CONST ends

.const ; this works, too...
BYTE "Change? Me, never.",0
DWORD 0CAB4DEADh ; also known as a hearse
Posted on 2002-10-25 10:38:39 by bitRAKE