Re: A challenge for RosAsm
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 22:09:57 -0400
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 .
- Follow-Ups:
- Re: A challenge for RosAsm
- From: asetofsymbols
- Re: A challenge for RosAsm
- References:
- A challenge for RosAsm
- From: Randall Hyde
- Re: A challenge for RosAsm
- From: Betov
- Re: A challenge for RosAsm
- From: Randall Hyde
- Re: A challenge for RosAsm
- From: Betov
- Re: A challenge for RosAsm
- From: Randall Hyde
- Re: A challenge for RosAsm
- From: wolfgang kern
- A challenge for RosAsm
- Prev by Date: Re: Article about HLA on Linux Journal's website
- Next by Date: Re: Article about HLA on Linux Journal's website
- Previous by thread: Re: A challenge for RosAsm
- Next by thread: Re: A challenge for RosAsm
- Index(es):