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

Discussion

Three of the following are reasons to avoid recursion in embedded code. The exception is

  • A.a static analyser cannot compute the worst-case usage
  • B.recursive functions cannot be written in C
  • C.the stack depth is hard to bound
  • D.each level costs a call frame in scarce RAM

Answer: B

Recursion is perfectly legal C and sometimes the clearest expression of an algorithm. It is avoided because the stack requirement depends on the data, which defeats both the sizing calculation and the tools that check it.

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

Post your comment

Please log in or register to post a comment.