Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

$ symbol in macro

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

$ symbol in macro

Hi OverHertz.

in zirutils.zir there were those two macros

inline procedure FillBuffer(buf, len, _ch) {
	push edi
	edi = buf;
	ecx = len;
	al = _ch;
	rep stosb
	pop edi
}

inline procedure strlcpy(dest, source, len) {
	push edi
	push esi
	push ecx

	//cld
	edi = $dest;
	esi = $source;
	ecx = $len;
	shr ecx, 2
	rep movsd

	ecx = $len;
	and ecx, 3
	rep movsb

	pop ecx
	pop esi
	pop edi
}

so i want to know when we need to use $ symbol with macro parameters like strlcpy macro,

and when we not need it like FillBuffer macro.

Emil.

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

sorry i believe i may have just missed to write the $ before the variable names when converting the procedure to an inline procedure :)

always macro variables begin with $, this allows the compiler to quickly know the difference and also makes it easier to read - allowing for someone to know which are macro variables and which are real variables :)

ps: Please remember to use code block when posting code.

[code]
   //Code Here

[/code]

Thanks for report also.