[OT] C vs C++

JN 666total at wp.pl
Tue Aug 30 20:02:44 UTC 2022


On Friday, 26 August 2022 at 21:16:20 UTC, Dukc wrote:
> 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.

I think there is a large group of programmers who are looking for 
a successor to C. C is attractive for several reasons. The 
limited set of features is a benefit sometimes, because you don't 
overthink your design and many libraries in C can interoperate 
with each other easily (compare with D where you have to reason 
OOP vs more functional style, @nogc vs GC or even betterC). Code 
completion will almost always work because there are no templates 
to get in your way (macros can be messy though). The ABI is well 
defined, so you can easily interact with your code from other 
languages. The WASM story is developing well too.

However, C is showing it's age. Manual memory management without 
any help from runtime/static analysis is passé. Lack of function 
and operator overloading is annoying. Arrays which decay to 
pointers and arrays that don't remember their length eat 
countless manhours trying to debug those issues.

Out of the newcoming languages, Zig is trying to fit that niche 
the most. I can't get over the syntax, but I'd really like to try 
it someday, when it reaches 1.0 version.


More information about the Digitalmars-d mailing list