this post was submitted on 25 Jan 2024
24 points (80.0% liked)

C Programming Language

993 readers
1 users here now

Welcome to the C community!

C is quirky, flawed, and an enormous success.
... When I read commentary about suggestions for where C should go, I often think back and give thanks that it wasn't developed under the advice of a worldwide crowd.
... The only way to learn a new programming language is by writing programs in it.

Β© Dennis Ritchie

🌐 https://en.cppreference.com/w/c

founded 1 year ago
MODERATORS
 

Personally, I have nothing against the emergence of new programming languages. This is cool:

  • the industry does not stand still
  • competition allows existing languages to develop and borrow features from new ones
  • developers have the opportunity to learn new things while avoiding burnout
  • there is a choice for beginners
  • there is a choice for specific tasks

But why do most people dislike the C language so much? But it remains the fastest among high-level languages. Who benefits from C being suppressed and attempts being made to replace him? I think there is only one answer - companies. Not developers. Developers are already reproducing the opinion imposed on them by the market. Under the influence of hype and the opinions of others, they form the idea that C is a useless language. And most importantly, oh my god, he's unsafe. Memory usage. But you as a programmer are (and must be) responsible for the code you write, not a language. And the one way not to do bugs - not doing them.

Personally, I also like the Nim language. Its performance is comparable to C, but its syntax and elegance are more modern.

And in general, I’m not against new languages, it’s a matter of taste. But when you learn a language, write in it for a while, and then realize that you are burning out 10 times faster than before, you realize the cost of memory safety.

This is that cost:

you are viewing a single comment's thread
view the rest of the comments
[–] pkill@programming.dev 1 points 9 months ago* (last edited 9 months ago) (2 children)

yeah if there's a popular "modern replacement for C" it'd be Go, similar procedural syntax with some functional features + great stdlib + static linking by default + easier concurrency + GC, but the new memory arenas feature looks like they're open to change and it's moving away from that dumbed down language for Google's junior devs it used to be known as

[–] shirro@aussie.zone 4 points 9 months ago (1 children)

I find Go a joy to maintain long term due to the high readability and stability of the language and standard libraries. In that respect I guess it isn't that dissimilar to classic languages like C or Pascal which can be used to write systems that are maintainable for many years.

On the downside Go has some questionable design decisions. Null pointers and multi-value result, err returns are the result of an inadequate type system. It should not be impossible to dereference a null pointer or access the result if there is an error. With discipline problems don't crop up that often but this is a solved problem in language design and pushes work onto the programmer that should be handled in the language.

Even with such serious deficiencies Go is still arguably one of the better alternatives to dynamic language like Python of Javascript and gets you most of the benefits of static languages without too much complexity. Having a runtime and garbage collection prevents Go use in libraries consumed by C and other languages and the overhead for calling into C is high. That disqualifies it as a modern C replacement.

The more I play with Zig, the more I like it. I don't think I could use it for anything I had to support at the moment. Realistically you are forced to develop live at head. Active third party dependencies often won't compile against stable versions. There aren't a lot of native libs yet but it really feels like it inherits all of C. There is a lot of stuff to like but it will be a more compelling language when it stabilizes.

[–] BatmanAoD@programming.dev 1 points 9 months ago

I hated the first nine words of this comment, but agree with everything else

[–] Rossphorus@lemmy.world 2 points 9 months ago

Zig also seems interesting. I'm definitely a fan of what I've seen of their error handling. Intercompatibility with C (no FFI required) also sounds tempting, especially if I already had a legacy C codebase I wanted to migrate.