Page 2 of 2

Re: Calculations in procedure declarations

Posted: Thu Sep 17, 2009 2:15 pm
by freak
Trond, you can poke holes in just about everything :D

> A macro code demonstrates that "ReplaceImageColor(0, 0)" is actually NOT literally turned into "ReplaceImageColor(0, 0, <default value>)"

Well yes. The compiler resolves the literal value at the declaration and then just places it into the call. Just look at the asm output and you see that the procedure is always called with the full set of arguments. My point was that in order to allow a function call, you cannot resolve the value when the declaration is compiled and so would run exactly into the kind of problem you tried to show with the macro code.

In the end, it would not be technically impossible, but it would be a lot more messy than it looks at first sight.

> This has to be a bug?

Yes. The compiler should complain about the Declare not matching the actual procedure.

Re: Calculations in procedure declarations

Posted: Thu Sep 17, 2009 2:20 pm
by PB
> Trond, you can poke holes in just about everything :D

+1

I'm constantly amazed by the reports that Trond posts. Sometimes I yell at the screen, "who cares?" when he posts a really obscure bug (you know, the ones where you have to be sitting a meter away from the keyboard and drinking only Lite Beer at precisely midnight for the bug to occur ;) ) but at the end of the day they ARE bugs and need fixing. So, good work, Trond. :) You're the bloodhound of the forum.

Re: Calculations in procedure declarations

Posted: Thu Sep 17, 2009 10:51 pm
by blueznl
Wow :shock:

Not sure if it matters, but damnit Trond, why are you not with CSI?

:P