Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A macro instruction is a group of programming instructions that have been compressed into a simpler form and appear as a single instruction. When used, a macro expands from its compressed form into its actual instruction details. Both the name of the macro definition and other variable parameter attributes are included within the macro statement.
Macro instructions were first used in the assembler language rather than a higher-level programming language. The way a macro expands to a set of instructions depends on the macro definition, which converts the macro into its detailed instructional form.
Macros save developers much time and effort, especially when dealing with a certain sequence of commands that is repeated more than once within the program body. Macros also save space and spare the programmer time spent on a long code block that may pertain to performing a single function.
The concept of macros is used within some precompilers, while higher-level languages focus on simplifying program and function writing, which makes the macro instruction a common element among most high-level programming languages. Macro instructions are generated together with the rest of the program by the assembler.