Re: Calculations in procedure declarations
Posted: Thu Sep 17, 2009 2:15 pm
Trond, you can poke holes in just about everything
> 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.

> 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.