Machine-translated by Google. Questions are authored in English.
Top

Discussion

A function using a static local is unsuitable for calling from both a task and an interrupt handler because it is

  • A.not reentrant, the two calls sharing the same state
  • B.too slow, static storage being in a distant memory region
  • C.unable to return a value to the handler
  • D.forbidden by the C standard in that situation

Answer: A

The handler's call can arrive part way through the task's and both then work on the same variable, so the results interleave. Passing the state in through a parameter, or giving the handler its own copy, is the remedy.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.