2 ms·
Excessively using macros in assembler, just as in any language, amounts to writing a translator (code generator); problem, then, is that the language being tran
by Koshkin 7y ago
Excessively using macros in assembler, just as in any language, amounts to writing a translator (code generator); problem, then, is that the language being translated from is usually crap, and the language being used to write the translator (the macro language) is also usually rather limited.
- mntmoss 7y agoWhat ad-hoc code generation lacks, as a rule, is type constraints and structured expression(syntax and semantics). If it has those, it is bordering on being a complete compiler. But if your base environment doesn't have notions of types or structured expressions either, which is mostly true of assemblers, then you are free to use macros to program at a higher level. The expressive power you gain by leveraging macros doesn't have a real downside because the core language is already so limited that it won't be more legible or maintainable to do it by hand.