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:

*removed externally hosted image*

  • LaMouette@jlai.lu
    ·
    5 months ago

    C is a nice language but performance is the least of the concerns for most development and prioritizing it above, for instance, readability is one of the biggest error you can make as a developper. C is not very strong at being readable. For instance as you said a char* can be anything in any format from binary media stream to text in random encoding. Also char* does not have the same meaning across various architecture. So good luck to be sure of what is happening. So I think it's good to let C where it's good at, low level softwares with performance as first requirement (forget about safety though) and with very senior people as developper.

  • pkill@programming.dev
    ·
    5 months ago

    you are responsible for the code you write

    https://9to5google.com/2022/12/01/android-memory-safety-rust/

  • BatmanAoD@programming.dev
    ·
    5 months ago

    Who benefits from C being suppressed and attempts being made to replace him? I think there is only one answer - companies. Not developers.

    You've missed the group that is most affected by software quality: end-users. Almost everyone in the world relies on computers in some way now, and bugs, especially security vulnerabilities, affect people who have no say in what languages people use to develop software.

    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.

    Sounds good. How do I, the end-user of software, hold developers accountable for bugs? I guess I can switch from one buggy operating system to another, or from one buggy browser to another.

    But also, do you honestly think that the choice of language does not impact software quality at all? Surely if you were forced to write software in a raw assembly, you'd find it more difficult to write a large and complex system correctly; right? But assembly is just another language; what makes C easier to use correctly? And if C is easier to write correctly than assembly, why would it be surprising that there are languages that are even easier to write correctly, especially after five decades of development in the extremely young field of computer science? Tools are important; your programming language (and compiler) is your first, most important, and most impactful tool as a developer.

    [C] remains the fastest among high-level languages.

    How are you determining that? C, C++, Rust, Fortran, Ada, and D all compile down to machine code, with no garbage collector (D's is optional). So there's not really any theoretical reason why they shouldn't all perform roughly the same. And, in fact, this is largely supported by evidence:

    • There's a fair amount of competition among grep type tools. grep itself is written in C and heavily optimized. I think it's fairly well known by now that ripgrep, written in Rust, is probably the fastest of these tools.
    • The TechEmpower web framework benchmarks maintains a ranking of the fastest web frameworks, updated each year. It doesn't look like the current version of the site shows what language each framework is written in, but the top three (may-minihttp, xitca-web, and ntex) are all Rust projects. The fourth (h2o) is in C.
    • The Benchmarks Game lets people submit programs in a wide variety of languages to solve a variety of problems, and these submissions are benchmarked and compared. Rust and C are effectively neck-and-neck (note that Rust currently does actually beat C in several of the challenges). See the second graph here for an overall visual comparison among languages.

    [Side-note: no one is "suppressing" C. I'm also not convinced anyone thinks C is "useless".]

      • BatmanAoD@programming.dev
        ·
        edit-2
        5 months ago

        Oh, Nim is possibly even a better example because it is "transpiled" rather than compiled, meaning the compiler actually generates C or C++ code. You can then compile that with whatever compiler you want. However, I don't know of any major projects in Nim to compare against ones in C, C++, Rust, etc.

        Edit: and Zig should be extremely efficient as well.

  • sus@programming.dev
    ·
    5 months ago

    another language that seems to get close to "C replacement" is Odin. Though it also does feel like departing a bit too much sometimes to be a true replacement.

    And what every new language seems to be dead set on is no implicit type conversions which is mildly annoying (But I suppose that's done specifically to protect from gremlins like me)

    • Oscar@programming.dev
      ·
      5 months ago

      The creator of Odin has stated that it is not aiming to replace C. It's its own thing. I suppose it has some degree of overlap, but I don't know the language well enough to speak on the differences. One thing I have read is that it does not support embedded devices very well.

      He said this in the comments of a youtube interview:

      *removed externally hosted image*

      • sus@programming.dev
        ·
        5 months ago

        I think my idea of "C replacement" probably fits fairly closely with Odin's creator's idea of "C alternative"..

        It's of course impossible to truly replace C with anything since C is an extremely entrenched language what with it being widely used for about 50 years. (and odin probably won't fit every niche where C is used)