From email by Michoel Chaikin:
"I have come across some funny behaviour using ONBC
preproccesor. I would image they count as bugs?
Firstly, consider;
#define DBG(msg) ErrAlertCustom
(0, msg, 0, 0)
#define DisplayMessage(msg) DBG(msg);
Why then does this work:
if(1) DBG("hi");
else DBG("bye");
But this doesn't!
if(1) DisplayMessage("hi");
else DisplayMessage("bye");
Using DisplayMessage("hi") in normal program logic
does not cause anything. As far as I can tell there is no
reason why it shouldn't work, though I don't currently
have access to a normal C Compiler to double-check.
Secondly while this compiles fine;
StrStr(s, "/*");
this wont;
#define foo "/*"
StrStr(s, foo);
"
Logged In: YES
user_id=116787
The first case doesn't work because
if(1) DisplayMessage("hi");
else DisplayMessage("bye");
gets expanded to:
if(1) DBG("hi");;
else DBG("bye");;
(Note the two semi-colons!) thus causing the else to
no-longer be associated with the if.
Getting burned by something similar to this in Java is why I
always use { and } with my if-statements, even if they're
just single lines.
The second case may still be a bug, though.
Logged In: YES
user_id=574706
Originator: NO
Since this 2nd case is a BUG I seccond this!