C/C++ is among the oldest languages, and still widely used. Many competitor languages came, to overcome drawbacks of Cpp, but none succeeded as much as Cpp. Those trying to fix Cpp, forgot to understand why C/Cpp stood the test of time from grandpa's generation.
It has a strong & great legacy. Most contemporary OS'es are written in C. So is the middleware for most hardware platforms. All this cannot be transitioned, by anyone, by whatever grand plan. So whatever new programmers say, C shall live forever.
But how did C++ overtake C? by being a superset, that only extended C with features. So also very constrained AnsiC, gave way to classes, C++, STL, C++98, Boost, C++11, and ongoing.
How about adding security, by removing error-prone constructs from historical C++. The approaches to create new languages were doomed from the start and could not overtake C++. So we need a construct that can sit within C/C++, to be easily absorbed not just by its programmers and also the existing code.
To this end, we can create a C+- language specification, which uses a feature.cfg file to define the features supported/rejected by the compiler. It'll have a line for each major standalone feature, each marked as unknown/supported/deprecated, where compiler must accept but generate warnings on deprecated features. C lang would just disable the classes feature. C++11.cfg file will define the entire C++11 standard, incl auto type feature. Disabling pointers feature will restrict directly accessing pointers outside the standard STL libraries.
Monday, December 9, 2019
Subscribe to:
Posts (Atom)