вторник, 11 февраля 2014 г.

Few words about compatibility


I’m C++ software developer and I love C++.
In modern world this confession may be considered as laziness of mind but I will argue – I do a big dive into other languages from time to time. It gives me new way of thinking, new ideas and new pleasure. Nevertheless I’m still with C++.
C++ is commonly acknowledged as multi-paradigm language and one of the reasons of its popularity is compatibility with C. To be more specific – many languages are in fact compatible with C. And some of them heavily rely on this compatibility, for instance you can write your library in C and then use it in Erlang. C++ is different; C is a part of core language. If we follow Liskov substitution principle – C++ is not compatible with C; it is in fact C.
I always felt that compatibility is weak argument. Moreover it sounds like cheap marketing trick. When Stroustrup after 30 years of the language history tells about compatibility this is very similar to interview with action movie star who tells that he was interested to dig into cultural background of the script. Hm... maybe.
I like unambiguous clarity of C and when I write something in C it feels like I really control a program. But when I see C code in C++ environment it’s terrible: lack of encapsulation, global variables, potential memory leaks, broken invariants and uninitialized variables – all kind of bad smell.
My verdict – C and C++ are not compatible; they just share common syntax.

Комментариев нет:

Отправить комментарий