The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+13 votes

State whether the following statements are True or False with reasons for your answer

  1. A subroutine cannot always be used to replace a macro in an assembly language program.

  2. A symbol declared as ‘external’ in an assembly language program is assigned an address outside the program by the assembler itself.

asked in Compiler Design by Veteran (59.5k points)
edited by | 493 views
can someone explain in detail ????

For part (B) refer ->

If the program is in several source files, and a variable is defined in file1 and used in file2 and file3, then extern declarations are needed in file2 and file3 to connect the occurrences of the variable. The usual practice is to collect extern declarations of variables and functions in a separate file, historically called a header, that is included by #include at the front of each source file. The suffix .h is conventional for header names.



why a is true?Any ref?

2 Answers

+17 votes
Best answer
  1. This is true. We can not replace macro entirely using subroutine. Ex -> Macro constant used for renaming.
  2. This is false. This is job of Linker.
answered by Boss (42.8k points)
selected by
Can we Say like this, Macros are evaluated at compile time where as subroutine at run time.

Plz correct me if i am wrong.
Can anyone please give the reason for 1st statement ??
Can some one tell code where macro is used but subroutine  not possible
0 votes
B is false, as extern will not allocate memory. the memory will be allocated when that variable will be initialized or declared.
answered by Loyal (8.2k points)
extern int i ... wat is the meaning of it ??
it mean memory is already allocated to this i outside of the function by linker not by assembler itself

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,748 questions
46,765 answers
58,513 users