Difficulty: Easy
Correct Answer: all of the above
Explanation:
Introduction / Context:
Storage assignment (or memory layout) is a core phase in compilation/assembly that maps program entities to addresses or offsets. Proper layout ensures correct access at runtime, efficient use of memory, and support for calling conventions and data initialization.
Given Data / Assumptions:
Concept / Approach:
The compiler/assembler allocates storage for global/static data, arranges stack frames for locals and temporaries, and places constants in literal pools or read-only segments. It also emits initialization records so the loader/runtime can set appropriate initial values before main executes.
Step-by-Step Solution:
Verification / Alternative check:
Standard compiler architecture references list symbol table management, stack frame layout, and data segment/literal pool generation as part of storage assignment and code generation.
Why Other Options Are Wrong:
Common Pitfalls:
Overlooking alignment and padding; confusing static initialization (loader) with dynamic initialization (constructor code); ignoring register allocation’s impact on temporary storage.
Final Answer:
all of the above
Discussion & Comments