Ask Question
16 June, 02:48

2 - In Ada, the choice lists of the case statement must be exhaustive, so that there can be no unrepresented values in the control expression. In C++, unrepresented values can be caught at run time with the default selector. If there is no default, an unrepresented value causes the whole statement to be skipped. What are the pros and cons of these two designs (Ada and C++) ? (at least 5 lines)

+2
Answers (1)
  1. 16 June, 04:48
    0
    Pros of Ada's design: Reliability. The programmer must manage all possible values. This prevents the programmer from accidentally forgetting to process certain values. It also increases readability, especially as it pertains to Reliability. When a programmer is reading code that has a case construct, it is easy to miss the fact that unrepresented values are not dealt with.

    Cons of Ada's design: Writability. The programmer may choose to have the program do nothing for

    unrepresented values. However, this is a very minor con since the default case can do nothing anyway.

    At least, requiring the programmer to include an empty default case, they must be explicit about the fact that they wish to do nothing for unrepresented values.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “2 - In Ada, the choice lists of the case statement must be exhaustive, so that there can be no unrepresented values in the control ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers