0
3.5kviews
Explain various modifiers and their purpose and use in Embedded system.
1 Answer
3
228views

Case (i): Modifier ‘auto’ or no modifier

  • It means that there is a ROM allocation for the variable, if it is initialized in the program.
  • RAM is allocated for the variable if it is not initialized in the program.

Case (ii): Modifier ‘unsigned’

  • Modifier for short/ int/ long data types
  • Directive to permit only positive values

Case (iii): Modifier ‘static’

  • Declaration is inside a function block
  • Directive to compiler that the variable should be accessible outside the function block also.
  • Helps when several tasks are executed in co-operation.

Case (iv): Modifier ‘static’

  • Declaration is outside a function block
  • Not usable outside the class or module in which it is declared.
  • ROM allocated by locator for function codes.

Case (v): Modifier ‘const’

  • Declaration is outside a function block
  • Must be initialized by program
  • ROM allocation by locator

Case (vi): Modifier ‘register’

  • Declaration is inside a function block
  • Must be initialized by a program
  • A CPU register is temporarily allocated when needed
  • No ROM/ RAM allocation

Case (vii): Modifier ‘interrupt’

  • On the entry of function code the compiler is directed to save all processors’ registers
  • On return from function compiler is directed to restore them

Case (viii): Modifier ‘extern’

  • Directs compiler to look for data type declaration or a function in a module other than the current one.

Case (ix): Modifier ‘volatile’

  • Declaration is outside a function block
  • Warning to compiler that an event can change its value or its change represents an event.

Case (x): Modifier ‘volatile static’

  • Declaration is inside a function block
  • Static - directive to compiler that variable should be accessible outside function block
  • Volatile - compiler cannot optimize the code
  • No ROM/ RAM allocation by locator
Please log in to add an answer.