Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #5483

About ADA, C++ and C ..

Newsgroups comp.programming.threads
Date 2020-01-19 14:47 -0800
Message-ID <f3280393-67dd-4c36-b45a-65b46a1ced4e@googlegroups.com> (permalink)
Subject About ADA, C++ and C ..
From aminer68@gmail.com

Show all headers | View raw


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.

Back to comp.programming.threads | Previous | Next | Find similar | Unroll thread


Thread

About ADA, C++ and C .. aminer68@gmail.com - 2020-01-19 14:47 -0800

csiph-web