Register | Login
Forum Index > Source Help > $ symbol in macro
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[114] $ symbol in macro - posted: 2011-10-24 21:15:53
Hi OverHertz.

in zirutils.zir there were those two macros
Code:
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
Admin
Site Admin

avatar

(send private message)

Posts: 932
Topics: 54

Location:
OverHertz Studio
[116] - posted: 2011-10-25 15:31:36
sorry i believe i may have just missed to write the $ before the variable names when converting the procedure to an inline procedure smile

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 smile

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

Code:
[code]
   //Code Here
[/code]


Thanks for report also.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 224 | Posts: 1847 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2022 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd