c++ in linux kernel

By: Linus Torvalds (torvalds.delete@this.linux-foundation.org), June 5, 2010 7:07 pm
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 >
TopicPosted ByDate
c++ in linux kernelnewbie2010/06/04 02:39 PM
  c++ in linux kernelrwessel2010/06/04 03:02 PM
    c++ in linux kernelslacker2010/06/04 10:18 PM
      Forums and C/C++David Kanter2010/06/05 01:17 AM
        Forums : flat vs. threaded.Dean Kent2010/06/05 05:59 AM
          Forums : flat vs. threaded.anonymous2010/06/05 02:00 PM
            Forums : flat vs. threaded.Rob Thorpe2010/06/05 06:28 PM
              Forums : flat vs. threaded.Dean Kent2010/06/05 08:37 PM
      c++ in linux kernelnewbie2010/06/05 10:10 AM
        c++ in linux kernelnksingh2010/06/05 10:44 AM
        c++ in linux kernelDavid Kanter2010/06/05 10:55 AM
        c++ in linux kernelHeath Provost2010/06/05 01:29 PM
          c++ in linux kernelLinus Torvalds2010/06/05 07:07 PM
            c++ in linux kernel?2010/06/06 12:34 AM
              c++ in linux kernelnksingh2010/06/06 08:14 AM
                c++ in linux kernelS. Rao2010/06/06 09:40 AM
              c++ in linux kernelmpx2010/06/06 01:17 PM
                c++ in linux kernelEduardoS2010/06/06 02:56 PM
              c++ in linux kernelLinus Torvalds2010/06/06 08:35 PM
                c++ in linux kernelMichael S2010/06/07 12:38 AM
                c++ in linux kernel?2010/06/07 12:47 AM
                  c++ in linux kernelPekka Enberg2010/06/07 04:35 AM
                    c++ in linux kernelMichael S2010/06/07 04:54 AM
                      c++ in linux kernelPekka Enberg2010/06/07 05:17 AM
                        c++ in linux kernelMichael S2010/06/07 05:50 AM
                          c++ in linux kernelPekka Enberg2010/06/07 05:57 AM
                    c++ in linux kernelVincent Diepeveen2010/06/23 05:10 AM
                      c++ in linux kernel?2010/06/24 01:22 AM
                  c++ in linux kernelnemlis2010/06/30 06:56 AM
                c++ in linux kernelMark Christiansen2010/06/07 08:11 AM
                c++ in linux kernelNeo2010/06/29 08:56 PM
                  Poor troll, try harder next time (NT)Matt Sayler2010/06/30 05:48 AM
                  c++ in linux kernelRohit2010/06/30 07:10 AM
              c++ in linux kernelgallier22010/06/07 05:43 AM
                c++ in linux kernelMichael S2010/06/07 06:07 AM
                  c++ in linux kernelgallier22010/06/07 06:35 AM
                    c++ in linux kernelMichael S2010/06/07 08:15 AM
                      c++ in linux kernelgallier22010/06/07 11:50 PM
                c++ in linux kernel?2010/06/07 10:31 PM
                  c++ in linux kernelMichael S2010/06/08 12:39 AM
                    c++ in linux kernel?2010/06/08 01:33 AM
                      c++ in linux kernelMichael S2010/06/08 05:38 AM
                        c++ in linux kernel?2010/06/08 07:23 AM
                          c++ in linux kernelMichael S2010/06/08 08:52 AM
                  c++ in linux kernelEduardoS2010/06/08 02:13 PM
              c++ in linux kernelCodeGrunt2010/06/12 10:19 AM
            c++ in linux kernelnewbie2010/06/06 08:04 AM
            c++0x any better?Max2010/06/06 04:33 PM
              c++0x any better?anon2010/06/07 07:32 PM
                c++0x any better?Michael S2010/06/08 01:02 AM
            c++ in linux kernelLispLover2010/06/06 09:46 PM
              c++ in linux kernelRob Thorpe2010/06/08 10:24 AM
            c++ in linux kernel - more disadvantagesVincent Diepeveen2010/06/08 04:55 AM
            c++ in linux kernelsomeone2010/06/08 08:22 AM
            c++ in linux kernelJohn Regehr2010/06/10 10:59 AM
            c++/java in linux kerneliirekm2010/06/11 07:02 AM
              c++/java in linux kernelanon2010/06/11 07:20 AM
                c++/java in linux kerneliirekm2010/06/11 07:38 AM
                  c++/java in linux kernelRob Thorpe2010/06/11 10:17 AM
                  Java is not just syntactic sugar on top of assemblyMark Roulo2010/06/11 11:31 AM
                    no it is :-)iirekm2010/06/11 12:47 PM
                      no it is :-)Mark Roulo2010/06/11 02:19 PM
                        no it is :-)iirekm2010/06/12 03:06 AM
                          no it is :-)Gabriele Svelto2010/06/14 02:32 AM
                  c++/java in linux kernelanon2010/06/11 07:33 PM
                c++/java in linux kernel?2010/06/11 08:41 AM
                  c++/java in linux kernelEduardoS2010/06/11 06:21 PM
                  c++/java in linux kernelanon2010/06/11 07:34 PM
                    C is more portable than assembly??2010/06/11 10:59 PM
                      C is more portable than assembly?anon2010/06/12 12:15 AM
                        C is more portable than assembly??2010/06/12 02:50 AM
                          C is more portable than assembly?anon2010/06/13 03:24 AM
            c++ in linux kernelBob2014/05/24 10:40 AM
        c++ in linux kernelAaron Spink2010/06/06 04:20 PM
          c++ in linux kernelRichard Cownie2010/06/07 07:49 AM
            c++ in linux kernelanon2010/06/07 03:17 PM
              c++ in linux kernelRichard Cownie2010/06/07 03:51 PM
                c++ in linux kernelAaron Spink2010/06/07 06:19 PM
                  c++ in linux kernelRichard Cownie2010/06/07 08:06 PM
                    c++ in linux kernelMark Roulo2010/06/08 06:56 AM
                      very interesting case study, thanks (NT)Richard Cownie2010/06/08 07:57 AM
                      Okay, wait, let me get that straightTimmy2010/06/21 08:07 PM
                        Split codebase..Anon2010/06/21 09:47 PM
                        Okay, wait, let me get that straightRichard Cownie2010/06/21 11:23 PM
                          Okay, wait, let me get that straightanonymous2010/06/22 12:34 AM
                            Okay, wait, let me get that straightMax2010/06/22 02:08 AM
                            Okay, wait, let me get that straightGabriele Svelto2010/06/22 03:51 AM
                              Okay, wait, let me get that straighthobold2010/06/22 05:47 AM
                                Okay, wait, let me get that straightSalvatore De Dominicis2010/06/22 06:00 AM
                            Okay, wait, let me get that straightRichard Cownie2010/06/22 05:19 AM
                            Okay, wait, let me get that straightMark Roulo2010/06/22 08:26 AM
                              Okay, wait, let me get that straightRob Thorpe2010/06/22 01:04 PM
                        Okay, wait, let me get that straightMark Roulo2010/06/22 08:21 AM
                        Okay, wait, let me get that straightEduardoS2010/06/22 02:07 PM
                c++ in linux kernelanon2010/06/07 08:27 PM
            Joke: C programs are high-performance?2010/06/07 10:52 PM
              Programmers Need To Learn Statistics Or I Will Kill Them Allanon2010/06/07 10:57 PM
                Programmers Need To Learn Statistics Or I Will Kill Them All?2010/06/07 11:24 PM
                  Programmers Need To Learn Statistics Or I Will Kill Them Allhobold2010/06/08 04:33 AM
                  Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo2010/06/08 06:44 AM
                    Programmers Need To Learn Statistics Or I Will Kill Them All?2010/06/08 07:33 AM
                      Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo2010/06/08 07:56 AM
                To kill programmers just ship them to Tomtom - Gestapo methods there (NT)Vincent Diepeveen2010/06/08 06:55 AM
            c++ productivityanon22010/06/08 06:57 AM
              c++ productivityLinus Torvalds2010/06/08 08:49 AM
                c++ productivityRob Thorpe2010/06/08 10:38 AM
                c++ productivityD.P.2010/06/08 01:25 PM
                  c++ productivityLinus Torvalds2010/06/08 08:27 PM
                    c++ productivityanon22010/06/09 11:32 AM
                      c++ productivityMark Roulo2010/06/09 01:15 PM
                        C with pointer checkingMax2010/06/09 02:05 PM
                          C with pointer checkingD.P.2010/06/09 10:06 PM
                            C with pointer checkingMax2010/06/10 12:56 PM
                              C with pointer checkingD.P.2010/06/10 01:16 PM
                        DIE FORTRAN, DIERohit2010/06/10 04:50 AM
                          DIE FORTRAN, DIEa reader2010/06/10 06:20 AM
                            DIE FORTRAN, DIEhobel2010/06/10 09:05 AM
                            DIE FORTRAN, DIED.P.2010/06/10 01:17 PM
                      c++ productivityD.P.2010/06/09 09:49 PM
                    c++ productivityMaxthon T. Chan2013/09/19 11:02 AM
                c++ productivityWalter Bright2010/06/10 09:30 AM
                  c++ productivityD.P.2010/06/10 01:28 PM
                    c++ productivityNick Sabalausky2010/06/10 02:54 PM
                      c++ productivityD.P.2010/06/10 08:57 PM
                        c++ productivityWalter Bright2010/06/11 10:15 AM
                          c++ productivityD.P.2010/06/11 01:26 PM
                            c++ productivityJesse Phillips2010/06/11 02:58 PM
                            c++ productivityWalter Bright2010/06/11 06:15 PM
                              c++ productivityD.P.2010/06/13 09:31 PM
                                c++ productivityNick Sabalausky2010/06/13 10:19 PM
                                c++ productivityWalter Bright2010/06/14 09:38 AM
                                  c++ productivityD.P.2010/06/15 03:18 AM
                            c++ productivityNick Sabalausky2010/06/11 08:41 PM
                Context-dependency considered harmful??2010/06/10 09:36 AM
                c++ productivityAlok2010/06/10 04:21 PM
                  c++ productivityLinus Torvalds2010/06/10 06:00 PM
                    c++ productivityanon2010/06/10 07:07 PM
                    c++ productivityEva2010/06/11 03:02 AM
                    c++ productivityOh Come On Dept2010/06/11 10:07 AM
                      c++ productivityLinus Torvalds2010/06/11 11:17 AM
                        c++ productivityMark Christiansen2010/06/11 12:16 PM
                          c++ productivityLinus Torvalds2010/06/11 04:35 PM
                            c++ productivitystubar2010/06/11 07:39 PM
                            c++ productivitya reader2010/06/12 05:30 AM
                              c++ productivityGabriele Svelto2010/06/14 04:18 AM
                                c++ productivityBrad Cantrell2010/06/14 07:54 AM
                            c++ productivity?2010/06/13 09:36 AM
                              c++ productivityJouni Osmala2010/06/14 02:01 AM
                                c++ productivityEduardoS2010/06/14 01:46 PM
                            c++ productivityTimmy2010/06/18 09:26 AM
                              c++ productivityEduardoS2010/06/18 01:59 PM
                                c++ productivityrwessel2010/06/18 03:06 PM
                                  c++ productivityEduardoS2010/06/19 07:31 AM
                                    c++ productivityrwessel2010/06/21 11:50 AM
                                      c++ productivityAnon2010/06/21 09:54 PM
                                        c++ productivityMark Roulo2010/06/22 08:10 AM
                                          c++ productivityEduardoS2010/06/22 02:34 PM
                                            c++ productivityMark Roulo2010/06/22 02:51 PM
                                        c++ productivityrwessel2010/06/22 12:42 PM
                                          c++ productivityAnon2010/06/22 05:05 PM
                                            c++ productivityrwessel2010/06/22 05:45 PM
                                              c++ productivityhobel2010/06/23 03:36 AM
                                                c++ productivityrwessel2010/06/23 12:19 PM
                                                  c++ productivityRob Thorpe2010/06/23 04:42 PM
                                                    c++ productivityhobel2010/06/24 02:12 AM
                                              c++ productivityMichael S2010/06/23 03:44 AM
                                                c++ productivityrwessel2010/06/23 11:33 AM
                                                  c++ productivityMichael S2010/06/23 01:27 PM
                                                    c++ productivityrwessel2010/06/23 02:25 PM
                                                      c++ productivityMichael S2010/06/23 11:37 PM
                                                        c++ productivityrwessel2010/06/24 12:19 PM
                                              c++ productivity - apologyrwessel2010/06/23 11:37 AM
                                              c++ productivityRob Thorpe2010/06/23 04:34 PM
                                                c++ productivityMark Roulo2010/06/23 05:11 PM
                                                  c++ productivityRob Thorpe2010/06/23 05:25 PM
                                              c++ productivityAnon2010/06/24 01:26 AM
                                c++ productivityanonymous2010/06/18 03:43 PM
                            c++ productivitytm2010/09/14 02:43 AM
                              c++ productivitygallier22010/09/14 03:41 AM
                        c++ productivityOh Come On Dept2010/06/11 01:52 PM
                c++ productivityKagamin2010/06/11 03:21 AM
                  c++ productivityanon2010/06/11 07:29 PM
                    c++ productivityDavid Kanter2010/06/13 09:37 AM
                      c++ productivityRichard Cownie2010/06/13 01:24 PM
                        c++ productivityCharles2010/06/14 10:41 AM
                          c++ productivityRichard Cownie2010/06/14 12:06 PM
                          well-designed C++ librariesD.P.2010/06/16 09:49 AM
                            boost sucksanon2010/06/16 07:13 PM
                              what c++ libraries does not suck?D.P.2010/06/16 11:09 PM
                                amount of ignorance to history?2010/06/17 04:14 AM
                                  amount of ignorance to historyCharles2010/06/17 10:33 PM
                                    amount of ignorance to historyanon2010/06/17 11:17 PM
                                      amount of ignorance to historyMark Christiansen2010/06/18 07:22 AM
                                        amount of ignorance to historyanon2010/06/18 08:39 AM
                                    Boost is being used to illustrate that good C++ is unreadable by mostMark Roulo2010/06/18 08:40 AM
                                    amount of ignorance to historyD.P.2010/06/18 03:13 PM
                            well-designed C++ librariesanon2010/06/17 12:20 AM
                              well-designed C++ librariesD.P.2010/06/18 03:25 PM
                                well-designed C++ librariesanon2010/06/18 08:57 PM
                                  well-designed C++ librariesD.P.2010/06/21 08:11 AM
                                well-designed C++ librariesKagamin2010/06/19 07:27 AM
                                  Lack of features can be a featureDavid Kanter2010/06/19 12:03 PM
                                  some features have global effectsRichard Cownie2010/06/19 12:44 PM
                                    some features have global effectsTimmy2010/06/20 09:11 AM
                      c++ productivityRob Thorpe2010/06/14 08:31 AM
                      c++ productivityKagamin2010/06/18 09:30 AM
                c++ productivityfast2010/06/11 10:47 PM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? 🍊