We’re often asked variations on the following question:
What constructs exist in Ada that do not have an equivalent construct in C/C++?
C++ is continuously evolving, and adding features all of the time, so it is depends largely on what particular version of C++, and perhaps which particular C++ compiler you are using. Here are some features that Ada programmers typically miss when they go to C/C++:
- Treating arrays as first class objects, rather than as simply a pointer to the first element, with associated lower and upper bounds.
- Nice syntax for defining aggregates representing “literal” values for arrays and records.
- Strong type checking of scalar types, rather than, for example, all 32-bit “ints” being considered equivalent from a type-checking point of view.
- Named notation with defaults for parameter passing.
- Integrated tasking and protected type model supporting a safe, “monitor”-like synchronization model with encapsulated task data.
- Abstract data types with encapsulation that can’t be easily defeated by calling buried “extern” functions.
- Natural support for user-defined operators without somewhat bizarre “friend” constructs or other concerns about “covariant” vs. “contravariant” return or parameter types and what kind of function to use.