• 257m@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    If don’t want to do low level programming why use C in the first place? The whole point of using C is so you can fiddle with pointers to have absolute control. Rust and Go are great alternatives that have built in strings.

    • FooBarrington@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      9 months ago

      But why does that mean C can’t implement a native string type?

      Why implement floats instead of making people do it themselves?

      • 257m@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        9 months ago

        Floats are implemented on most hardware by the instruction set so the language has no control over those unless your programming on a microcontroller like an atmega328p in which case you have to implement it yourself. As for why no in built support for strings is available in C is mostly due to C programmer hating change. Most hardcore C programmers are still using C89 (and the majority C99) and you can’t change old standards. C dosen’t need more features it needs less. I am a big fan of removing for loops like Zig to make the langauge simpler. That way it can maintain its minimalism. The more minimalistic the easier to write compilers.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          9 months ago

          Modern hardware also has specific instructions to speed up C string operations for the common ways they are implemented. We rely on compiler optimisation for those as well. Why not do the same for floats?