Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About ADA, C++ and C ..

1 view
Skip to first unread message

amin...@gmail.com

unread,
Jan 19, 2020, 5:47:53 PM1/19/20
to
Hello..


About ADA, C++ and C ..

Ada was designed to support a high-level of abstraction and, in particular, safe abstractions. The C philosophy is to keep the design of the language simple, and the runtime overhead minimal, at the cost of safety. The C++ philosophy, centered on the concept of “zero-cost abstractions,” is that as few safeguards as possible are added by the compiler, especially if those safe-guards imply a runtime cost. Ada’s philosophy tends to be at the opposite of the spectrum, favoring safety before other criteria.

And what are zero-cost abstractions in programming languages?

Zero cost abstractions are exemplified by C++

For example a C++ std::vector object is almost like a C array except it can grow and shrink - It has a more abstract and powerful interface than a C array.

However the runtime performance of a vector is identical to that of an array - the additional features in a std::vector do not cost anything at runtime if you were to replace a dynamically allocated C array with a vector.

Most C++ features are like this - in fact it’s one of the primary considerations for a feature to be added to the language.

In C++, operator overloading, static inheritance, constexpr, templates, deterministic destruction and references are all features that introduce a more powerful abstraction that costs nothing at runtime.
You could try writing alternative code without using that feature and it would not be any faster.


Thank you,
Amine Moulay Ramdane.


0 new messages