Re: A challenge for RosAsm



wolfgang kern wrote:
My opinion about Macros:

* + reduces source size

Mmmm, "%define REALLY_LONG_NAME_FOR_A_SMALL_INTEGER 0" doesn't even do that...

- on cost of 'direct readability'

Macros *can* improve readability (a matter of opinion, of course).

- bloats the .exe (in hidden form)

Not always. Suppose I use the asmutils macro:

sys_write stdout, msg, msg_len

If I define "Linux" or "BSD" on Nasm's command line, I get appropriate code for either OS - just what's needed, no bloat. Compared to the alternatives, either providing both versions and switching at runtime, or linking against libraries for portability, that's *less* bloat.

* + minor convenience for lazy programmers

In some cases, not so minor...

* - any change in it will affect many program parts.

This can be an advantage! Do you really want to scan through your code changing each instance?


So if I need several similar code parts, I either
write one routine which cover all wanted variations, or
I just copy/paste and modify as desired.

Okay - a macro can do the copy-paste-modify automatically, and accurately(!)... if properly used.


And I never would hide any code block, as parts and trails
often can be used more than one time, so I must see it.

Well, I like to see my code too. I'm not a *huge* fan of macros. I've seen a lot of code using macros "badly"(IMO) which has exactly the effects (defects!) you describe. But I wouldn't issue a blanket comdemnation on that account - any tool can be misused.


Properly designed, and properly used, macros *can* show an "improvement" in the very areas you mention. Not all macros are created equal.

Well, ya *knew* you weren't the only one with an opinion :)

Best,
Frank
.