GCC 15 Moves C Default Language Version To C23

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • kpedersen
    Senior Member
    • Jul 2012
    • 2675

    #11
    Originally posted by klapaucius View Post

    I don't see a valid reason in 2024 to start a new project in C instead of using a more modern language with higher level of abstractions.
    You might not see it yet but this will come with experience. Perhaps ask some professional developers why they start projects in C. You will likely learn a lot from their responses.

    In the mean time, try writing a library in Python and consume it from Java. Note the difficulties you inevitably run into.
    Last edited by kpedersen; 17 November 2024, 02:37 PM.

    Comment

    • klapaucius
      Senior Member
      • Mar 2015
      • 157

      #12
      Originally posted by F.Ultra View Post


      There are lots of good reasons to start new projects in C in 2024 (every single project where I work is done in C). A major one is that you are a veteran level C programmer with over 20 years of experience, trying to start a project in Rust would be to start from close to scratch and transform the same person to a novice level programmer.
      Right, this reason becomes a liability with time, as the number of veteran level C programmers who are not proficient (or refuse to learn) more modern languages dwindle. It is not really a technical reason, rather a social reason.

      To be honest I see far more logic problems in applications than I see security issues, so IMHO the insecurity of C is way overblown (depends on context case ofc).
      It's not so much about the insecurity, it's about focussing on a higher level of logic, using abstractions instead of reinventing the wheel, or about the opportunity of adopting different programming paradigms (again, by raising the level of abstraction).
      Last edited by klapaucius; 17 November 2024, 04:37 PM.

      Comment

      • klapaucius
        Senior Member
        • Mar 2015
        • 157

        #13
        Originally posted by kpedersen View Post

        You might not see it yet but this will come with experience. Perhaps ask some professional developers why they start projects in C. You will likely learn a lot from their responses.
        If the reason is because that's the language they have learnt years ago and the only one they master with confidence, it's not a good reason.

        In the mean time, try writing a library in Python and consume it from Java. Note the difficulties you inevitably run into.
        I understand this. What I don't understand is: if you want to write a new library to be consumed in Java, why don't you write it in Java?

        Comment

        • F.Ultra
          Senior Member
          • Feb 2010
          • 2030

          #14
          Originally posted by klapaucius View Post

          Right, this reason becomes a liability with time, as the number of veteran level C programmers who are not proficient (or refuse to learn) more modern languages dwindle. It is not really a technical reason, rather a social reason.
          Since we use C for everything where I work (including for web pages) us the experienced ones teach the new recruits how to properly code in C so here it will continue long after I'm gone.

          Originally posted by klapaucius View Post
          It's not so much about the insecurity, it's about focussing on a higher level of logic, using abstractions instead of reinventing the wheel, or about the opportunity of adopting different programming paradigms (again, by raising the level of abstraction).
          There are no reinventing the wheel, once you have programmed for more than a short novice period you start to collect routines and internal libraries that perform the very same thing that the new languages provide. Sometimes it is as if proponents of new languages think that people just throws away code and routines and start from scratch in every single project.

          That vast collection of well debugged and fine tuned routines and libraries are also part of why the "we are not switching to something new" is not only social but also highly technical.

          Comment

          • AHSauge
            Phoronix Member
            • May 2008
            • 117

            #15
            Originally posted by klapaucius View Post

            Just a prejudice. Let me put in this way, apart from dealing with legacy code (and certainly there's a lot in C) I don't see a valid reason in 2024 to start a new project in C instead of using a more modern language with higher level of abstractions. But there's still this common myth that C is *THE* language, upon which everything is built and must continue to be built, that is more performant than any other language, that coding in C gives you full control and forces you to be a better programmer, because you have to learn how to handle the intrinsic unsafety. Therefore any addition to the standard is considered an addition of complexity, of overhead, an aid that *real* coders don't need.
            I've no idea how you've concluded with this. C is the foundation of most languages whether you like to admit it or not. Most languages are unable to link with other libraries without C or pretending to be C. It's one of only a handful of programming languages that are capable of booting up your device. So yeah, there are multiple reasons to pick C.

            ...and FYI, my preference is firmly on C++ and Rust over C. However, none of them have a stable ABI, so with both, you have to pretend to be C sometimes.

            Comment

            • DavidBrown
              Senior Member
              • Jan 2016
              • 155

              #16
              Originally posted by klapaucius View Post

              Just a prejudice. Let me put in this way, apart from dealing with legacy code (and certainly there's a lot in C) I don't see a valid reason in 2024 to start a new project in C instead of using a more modern language with higher level of abstractions. But there's still this common myth that C is *THE* language, upon which everything is built and must continue to be built, that is more performant than any other language, that coding in C gives you full control and forces you to be a better programmer, because you have to learn how to handle the intrinsic unsafety. Therefore any addition to the standard is considered an addition of complexity, of overhead, an aid that *real* coders don't need.
              The first myth to dispel is that there is such a myth as you describe. While it is true plenty of code is written in C when it would probably have been better (for some of the many possible values of "better") to write it in a different language, a great deal of code is still written in C because it is the most appropriate choice of language. It is the most portable programming language (though certainly not all code is, or should be, portable), and it is the "lowest common denominator" of programming languages. That means that for things like libraries that will be used by various other languages, run-time support for other languages, virtual machines, etc., C is typically the technically best choice. It is also often the appropriate choice for a lot of low-level coding, high performance sections of code, embedded development, etc. Most code can be, and should be, written in higher level languages. But dig below the surface, and you will always find C code. This will continue to be the case until there is something better than C for the job - and no doubt it will continue long after that. (And no, Rust is not better for the purpose.)

              There are a few programmers who believe "the original is best", or that "real programmers use ANSI C" (by which they mean, somewhat inaccurately, C89/C90 - if you purchase a copy of the current C standard from ANSI, you get C17). Fortunately, such attitudes are rare amongst serious and professional programmers. Most people writing C code today either don't know and don't care about standards (they get the default their compiler version gives them), use the standard version already used for existing code in the existing project, or pick the newest standard that fits with their portability requirements. Currently, that last one usually means C11, as C17 is little more than a minor bug-fix, combined with compiler-specific features and extensions. Serious programmers want to use the best language features they can, and the best tools they can get.

              Comment

              • klapaucius
                Senior Member
                • Mar 2015
                • 157

                #17
                Originally posted by F.Ultra View Post
                Since we use C for everything where I work (including for web pages) us the experienced ones teach the new recruits how to properly code in C so here it will continue long after I'm gone.
                You're certainly aware that C is far down in the list of the most used languages for web development (and not only for that)*. My observation about the decreasing number of people learning C wasn't limited to a particular company.

                *(incidentally, in one of my previous jobs, they also wrote web guis in C++, using WebToolkit. It was fine for me because I could still code in C++, but the reason why the chose it, was because otherwise they should have either hired a web developer or learned some Javascript and React)

                There are no reinventing the wheel, once you have programmed for more than a short novice period you start to collect routines and internal libraries that perform the very same thing that the new languages provide. Sometimes it is as if proponents of new languages think that people just throws away code and routines and start from scratch in every single project.

                That vast collection of well debugged and fine tuned routines and libraries are also part of why the "we are not switching to something new" is not only social but also highly technical.
                I hadn't heard the word "routine" for a long time :-) Jokes apart, OK, I understand that, but these libraries, exactly because they were developed for specific needs and are property of individual companies, cannot be a valid alternative to more wide available, generic, standard libraries, which are the kind of tools that beginners look for when they start coding and want to produce something immediately.
                Last edited by klapaucius; 19 November 2024, 03:52 PM.

                Comment

                • klapaucius
                  Senior Member
                  • Mar 2015
                  • 157

                  #18
                  Originally posted by AHSauge View Post
                  I've no idea how you've concluded with this. C is the foundation of most languages whether you like to admit it or not. Most languages are unable to link with other libraries without C or pretending to be C. It's one of only a handful of programming languages that are capable of booting up your device. So yeah, there are multiple reasons to pick C.

                  ...and FYI, my preference is firmly on C++ and Rust over C. However, none of them have a stable ABI, so with both, you have to pretend to be C sometimes.
                  As I said, it was a prejudice, based on my limited experience. But the rest that you say is true. I still think that the situations were C would be the "best tool for the job" are decreasing, unless we consider other factors, such as: how much would it cost to learn a new language?

                  Comment

                  • F.Ultra
                    Senior Member
                    • Feb 2010
                    • 2030

                    #19
                    Originally posted by klapaucius View Post
                    You're certainly aware that C is far down in the list of the most used languages for web development (and not only for that)*. My observation about the decreasing number of people learning C wasn't limited to a particular company.
                    Well aware of that, hence why I added the word "including" to point it out since I know how rare it is. What I meant with that was that since we even do that in C we internally teach our web developers to be good C devs so in this particular place C will live long after I'm gone.

                    Originally posted by klapaucius View Post
                    I hadn't heard the word "routine" for a long time :-) Jokes apart, OK, I understand that, but these libraries, exactly because they were developed for specific needs and are property of individual companies, cannot be a valid alternative to more wide available, generic, standard libraries, which are the kind of tools that beginners look for when they start coding and want to produce something immediately.
                    That was just a small example, what is more important is that there is basically no protocol or format out there where the original developer haven't released a reference implementation in C (rare exceptions are old MS stuff like COM) and the world is full of open source libraries written in C that can do exactly what your framework for language X does and more. Ofc it is more convenient to have everything nicely bundled with the same syntax and common docs, but I have also noticed in my 42 years as a programmer that people that learn such languages are often (often, not always) stuck in the mentality that if it doesn't exist in the framework then it cannot be done.

                    One really idiotic example of this was at a prior work place (where we inherited idiots due to a merger) where the entire new dev team switched from C++ to Java "so that they could decode XML files", something that apparently was "impossible to do in C++" and the new CTO was amazed when I told him that we in the old dev team decoded XML files with C. I think that he still to this day believes that I lied to him. That was btw the same brain trust that spent a whole year planning before they upgraded their compiler in Solaris.

                    Comment

                    Working...
                    X