2016-08-16 18:52 GMT+03:00 Heikki Linnakangas <hlinnaka@iki.fi>:
> On 08/16/2016 05:47 PM, Jim Nasby wrote:
>>
>> I realize there's little technical reason why we *need* C++ support. The
>> level if discipline applied to our codebase negates some of the benefits
>> of C++. But maintaining the discipline takes a lot of time and effort,
>> and makes it more difficult to attract new contributors.
>
>
> I suspect that it would take as much discipline to keep a C++ codebase
> readable, as the current C codebase. If not more.
For example, its easier and less error prone to define structures with
virtual functions in C++ than write vtables manually in C. So, the adequate
subset of the C++ features can be useful to write more readable and
maintainable C-style code. These features are:
- abstract classes (well, structures with virtual functions); - RTTI; - lambda functions; - constexpr functions; -
destructors;- templates (very reservedly).
But these features should be avoided (as least for now):
- exceptions; - the parts of the standard library which generates exceptions (in particular, regex and thread).
--
// Dmitry.