c++ in linux kernel

By: Linus Torvalds (torvalds.delete@this.linux-foundation.org),
Room: Moderated Discussions
Heath Provost (galvanash@hotmail.com) on 6/5/10 wrote:
>
>As for C++ exceptions - the same thing really applies here.
>They are trying to write explicit code. Exceptions are the
>poster child for implicit magic...

Yes, exceptions is a good example. The Linux kernel actually
does its own exception mechanism, exactly because that way
we control what is going on (and do it much more targeted
to the actual need in question while giving much better
performance and avoiding the crazy unwinding issues).

And I really do dislike C++. It's a really bad language, in
my opinion. It tries to solve all the wrong problems, and
does not tackle the right ones. The things C++ "solves"
are trivial things, almost purely syntactic extensions to
C rather than fixing some true deep problem.

(The C++ objects, templates and function overloading are
all just syntactic sugar. And generally bad syntax
at that. And C++ actually makes the C type system actively
worse.)

In non-systems programming, you should almost certainly
use a language that offers garbage collection. That will
possibly make a real difference in the complexity of
your application. The C++ features? Largely useless, and
just helps you screw up more.

And in systems programming, you're simply better off with
C. You'll have a way easier time using all the existing
code and libraries out there (re-using C++ code? Good
luck). Fewer headaches, fewer opportunities to mess up the
design and pick some unstable template library.

So in neither case is C++ likely the right choice.

Linus
< Previous Post in ThreadNext Post in Thread >
Thread (207 posts)
TopicPosted ByPosted
c++ in linux kernelnewbie
  c++ in linux kernelrwessel
    c++ in linux kernelslacker
      Forums and C/C++David Kanter
        Forums : flat vs. threaded.Dean Kent
          Forums : flat vs. threaded.anonymous
            Forums : flat vs. threaded.Rob Thorpe
              Forums : flat vs. threaded.Dean Kent
      c++ in linux kernelnewbie
        c++ in linux kernelnksingh
        c++ in linux kernelDavid Kanter
        c++ in linux kernelHeath Provost
          c++ in linux kernelLinus Torvalds
            c++ in linux kernel?
              c++ in linux kernelnksingh
                c++ in linux kernelS. Rao
              c++ in linux kernelmpx
                c++ in linux kernelEduardoS
              c++ in linux kernelLinus Torvalds
                c++ in linux kernelMichael S
                c++ in linux kernel?
                  c++ in linux kernelPekka Enberg
                    c++ in linux kernelMichael S
                      c++ in linux kernelPekka Enberg
                        c++ in linux kernelMichael S
                          c++ in linux kernelPekka Enberg
                    c++ in linux kernelVincent Diepeveen
                      c++ in linux kernel?
                  c++ in linux kernelnemlis
                c++ in linux kernelMark Christiansen
                c++ in linux kernelNeo
                  Poor troll, try harder next time (NT)Matt Sayler
                  c++ in linux kernelRohit
              c++ in linux kernelgallier2
                c++ in linux kernelMichael S
                  c++ in linux kernelgallier2
                    c++ in linux kernelMichael S
                      c++ in linux kernelgallier2
                c++ in linux kernel?
                  c++ in linux kernelMichael S
                    c++ in linux kernel?
                      c++ in linux kernelMichael S
                        c++ in linux kernel?
                          c++ in linux kernelMichael S
                  c++ in linux kernelEduardoS
              c++ in linux kernelCodeGrunt
            c++ in linux kernelnewbie
            c++0x any better?Max
              c++0x any better?anon
                c++0x any better?Michael S
            c++ in linux kernelLispLover
              c++ in linux kernelRob Thorpe
            c++ in linux kernel - more disadvantagesVincent Diepeveen
            c++ in linux kernelsomeone
            c++ in linux kernelJohn Regehr
            c++/java in linux kerneliirekm
              c++/java in linux kernelanon
                c++/java in linux kerneliirekm
                  c++/java in linux kernelRob Thorpe
                  Java is not just syntactic sugar on top of assemblyMark Roulo
                    no it is :-)iirekm
                      no it is :-)Mark Roulo
                        no it is :-)iirekm
                          no it is :-)Gabriele Svelto
                  c++/java in linux kernelanon
                c++/java in linux kernel?
                  c++/java in linux kernelEduardoS
                  c++/java in linux kernelanon
                    C is more portable than assembly??
                      C is more portable than assembly?anon
                        C is more portable than assembly??
                          C is more portable than assembly?anon
            c++ in linux kernelBob
        c++ in linux kernelAaron Spink
          c++ in linux kernelRichard Cownie
            c++ in linux kernelanon
              c++ in linux kernelRichard Cownie
                c++ in linux kernelAaron Spink
                  c++ in linux kernelRichard Cownie
                    c++ in linux kernelMark Roulo
                      very interesting case study, thanks (NT)Richard Cownie
                      Okay, wait, let me get that straightTimmy
                        Split codebase..Anon
                        Okay, wait, let me get that straightRichard Cownie
                          Okay, wait, let me get that straightanonymous
                            Okay, wait, let me get that straightMax
                            Okay, wait, let me get that straightGabriele Svelto
                              Okay, wait, let me get that straighthobold
                                Okay, wait, let me get that straightSalvatore De Dominicis
                            Okay, wait, let me get that straightRichard Cownie
                            Okay, wait, let me get that straightMark Roulo
                              Okay, wait, let me get that straightRob Thorpe
                        Okay, wait, let me get that straightMark Roulo
                        Okay, wait, let me get that straightEduardoS
                c++ in linux kernelanon
            Joke: C programs are high-performance?
              Programmers Need To Learn Statistics Or I Will Kill Them Allanon
                Programmers Need To Learn Statistics Or I Will Kill Them All?
                  Programmers Need To Learn Statistics Or I Will Kill Them Allhobold
                  Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo
                    Programmers Need To Learn Statistics Or I Will Kill Them All?
                      Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo
                To kill programmers just ship them to Tomtom - Gestapo methods there (NT)Vincent Diepeveen
            c++ productivityanon2
              c++ productivityLinus Torvalds
                c++ productivityRob Thorpe
                c++ productivityD.P.
                  c++ productivityLinus Torvalds
                    c++ productivityanon2
                      c++ productivityMark Roulo
                        C with pointer checkingMax
                          C with pointer checkingD.P.
                            C with pointer checkingMax
                              C with pointer checkingD.P.
                        DIE FORTRAN, DIERohit
                          DIE FORTRAN, DIEa reader
                            DIE FORTRAN, DIEhobel
                            DIE FORTRAN, DIED.P.
                      c++ productivityD.P.
                    c++ productivityMaxthon T. Chan
                c++ productivityWalter Bright
                  c++ productivityD.P.
                    c++ productivityNick Sabalausky
                      c++ productivityD.P.
                        c++ productivityWalter Bright
                          c++ productivityD.P.
                            c++ productivityJesse Phillips
                            c++ productivityWalter Bright
                              c++ productivityD.P.
                                c++ productivityNick Sabalausky
                                c++ productivityWalter Bright
                                  c++ productivityD.P.
                            c++ productivityNick Sabalausky
                Context-dependency considered harmful??
                c++ productivityAlok
                  c++ productivityLinus Torvalds
                    c++ productivityanon
                    c++ productivityEva
                    c++ productivityOh Come On Dept
                      c++ productivityLinus Torvalds
                        c++ productivityMark Christiansen
                          c++ productivityLinus Torvalds
                            c++ productivitystubar
                            c++ productivitya reader
                              c++ productivityGabriele Svelto
                                c++ productivityBrad Cantrell
                            c++ productivity?
                              c++ productivityJouni Osmala
                                c++ productivityEduardoS
                            c++ productivityTimmy
                              c++ productivityEduardoS
                                c++ productivityrwessel
                                  c++ productivityEduardoS
                                    c++ productivityrwessel
                                      c++ productivityAnon
                                        c++ productivityMark Roulo
                                          c++ productivityEduardoS
                                            c++ productivityMark Roulo
                                        c++ productivityrwessel
                                          c++ productivityAnon
                                            c++ productivityrwessel
                                              c++ productivityhobel
                                                c++ productivityrwessel
                                                  c++ productivityRob Thorpe
                                                    c++ productivityhobel
                                              c++ productivityMichael S
                                                c++ productivityrwessel
                                                  c++ productivityMichael S
                                                    c++ productivityrwessel
                                                      c++ productivityMichael S
                                                        c++ productivityrwessel
                                              c++ productivity - apologyrwessel
                                              c++ productivityRob Thorpe
                                                c++ productivityMark Roulo
                                                  c++ productivityRob Thorpe
                                              c++ productivityAnon
                                c++ productivityanonymous
                            c++ productivitytm
                              c++ productivitygallier2
                        c++ productivityOh Come On Dept
                c++ productivityKagamin
                  c++ productivityanon
                    c++ productivityDavid Kanter
                      c++ productivityRichard Cownie
                        c++ productivityCharles
                          c++ productivityRichard Cownie
                          well-designed C++ librariesD.P.
                            boost sucksanon
                              what c++ libraries does not suck?D.P.
                                amount of ignorance to history?
                                  amount of ignorance to historyCharles
                                    amount of ignorance to historyanon
                                      amount of ignorance to historyMark Christiansen
                                        amount of ignorance to historyanon
                                    Boost is being used to illustrate that good C++ is unreadable by mostMark Roulo
                                    amount of ignorance to historyD.P.
                            well-designed C++ librariesanon
                              well-designed C++ librariesD.P.
                                well-designed C++ librariesanon
                                  well-designed C++ librariesD.P.
                                well-designed C++ librariesKagamin
                                  Lack of features can be a featureDavid Kanter
                                  some features have global effectsRichard Cownie
                                    some features have global effectsTimmy
                      c++ productivityRob Thorpe
                      c++ productivityKagamin
                c++ productivityfast