c++ in linux kernel

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