[OT] C vs C++

Paulo Pinto pjmlp at progtools.org
Wed Aug 31 05:33:34 UTC 2022


On Tuesday, 30 August 2022 at 20:02:44 UTC, JN wrote:
> 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.

C was already showing its age in the mid-90's, when compared 
againt languages like Modula-2 (1978) or Object Pascal (1986), 
and in what concerns language features (except for comptime), Zig 
is pretty much what those languages offered.

The key question remains, will the UNIX folks and embedded 
hardware communities, ever adopt anything other than C?

Even on the embedded world, using C99 is considered being modern, 
let alone something else.


More information about the Digitalmars-d mailing list