Which one of the following is also called as pseudo instructions that are not directly translated into machine language instructions ?

Which one of the following is also called as pseudo instructions that are not directly translated into machine language instructions ? Correct Answer Macro expansions

Option 1) is the correct answer.

Macro expansions:- A macro consists of a name, set of formal parameters and body of code. The use of macro name with set of actual parameters is replaced by some code generated by its body.

Key Points

  • To simplify and reduce the amount of repetitive coding
  • To reduce errors caused by repetitive coding.
  • To make an assembly program more readable.
     

Macros allow a programmer to define pseudo operations, typically operations that are generally desirable, are not implemented as part of the processor instruction, and can be implemented as a sequence of instructions. Each use of a macro generates new program instructions, the macro has the effect of automating the writing of the program.

Macros can be defined used in many programming languages, like C, C++, etc. Example macro in C programming. Macros are commonly used in C to define small snippets of code. If the macro has parameters, they are substituted into the macro body during expansion; thus, a C macro can mimic a C function. The usual reason for doing this is to avoid the overhead of a function call in simple cases, where the code is lightweight enough that function call overhead has a significant impact on performance.

Example:- 

#define max (a, b) a>b? A: b
Defines the macro max, taking two arguments a and b. This macro may be called like any C function, using identical syntax. Therefore, after preprocessing

z = max(x, y);

Becomes z = x>y? X:y;

Related Questions