Ask Question
21 November, 18:09

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)

+3
Answers (1)
  1. 21 November, 19:19
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers