Ask Question
11 July, 09:38

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)

+5
Answers (1)
  1. 11 July, 10:03
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers