[OT] C vs C++
Dukc
ajieskola at gmail.com
Fri Aug 26 21:16:20 UTC 2022
C++ is meant as an advancement of C. And it's used as one. Dmd
was written in C++ until version 2.069, and countless other
programs, both open and closed source still use it. It makes
sense - it's a superset of C (well, almost), so one can always
fall back to C features when the more complex features of C++
don't justify themselves.
Yet, many of the most well-known and successful programmers
[don't see it like
that](https://harmful.cat-v.org/software/c++/coders-at-work). Can
it be that C++ is so complex that even conservative use of it
makes your codebase so unreadable that even the archaic C is a
better choice? Think how crazy this is - the cream of of our
profession resort to pointer / length pairs over `std::vector`,
and copy-pasting the module name to every public declaration over
using namespaces.
There has to be HUGE downsides in C++ for this competent people
to resort to this drastic avoidance. They do say what the
downsides of C++ are about: too big a language to learn well, so
code ends up using features the reader does not know. Still, if
this is the case one would think it had been long since generally
aknowledged: C++ guidebooks would tell to avoid less-known
language features absent strong reasons, and later languages
ought to have more pressure to be more minimalist like Go and
less "CISC" like D or Rust. Yet, complex D features like ranges
(okay, more of a Phobos feature), operator overloading, CTFE,
objects and templates don't seem to be commonly hated.
This inconsistency in our attitude towards language complexity is
interesting in my opinion. I want to hear your opinions, would
you rather use C or C++ in your job if you had to pick one ("it
depends"-answers okay). But most importantly, why? What do you
make of that C++ complexity seems to be so appreciated and so at
contempt at the same time?
More information about the Digitalmars-d
mailing list