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
>
>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
Topic | Posted By | Date |
---|---|---|
c++ in linux kernel | newbie | 2010/06/04 02:39 PM |
c++ in linux kernel | rwessel | 2010/06/04 03:02 PM |
c++ in linux kernel | slacker | 2010/06/04 10:18 PM |
Forums and C/C++ | David Kanter | 2010/06/05 01:17 AM |
Forums : flat vs. threaded. | Dean Kent | 2010/06/05 05:59 AM |
Forums : flat vs. threaded. | anonymous | 2010/06/05 02:00 PM |
Forums : flat vs. threaded. | Rob Thorpe | 2010/06/05 06:28 PM |
Forums : flat vs. threaded. | Dean Kent | 2010/06/05 08:37 PM |
c++ in linux kernel | newbie | 2010/06/05 10:10 AM |
c++ in linux kernel | nksingh | 2010/06/05 10:44 AM |
c++ in linux kernel | David Kanter | 2010/06/05 10:55 AM |
c++ in linux kernel | Heath Provost | 2010/06/05 01:29 PM |
c++ in linux kernel | Linus Torvalds | 2010/06/05 07:07 PM |
c++ in linux kernel | ? | 2010/06/06 12:34 AM |
c++ in linux kernel | nksingh | 2010/06/06 08:14 AM |
c++ in linux kernel | S. Rao | 2010/06/06 09:40 AM |
c++ in linux kernel | mpx | 2010/06/06 01:17 PM |
c++ in linux kernel | EduardoS | 2010/06/06 02:56 PM |
c++ in linux kernel | Linus Torvalds | 2010/06/06 08:35 PM |
c++ in linux kernel | Michael S | 2010/06/07 12:38 AM |
c++ in linux kernel | ? | 2010/06/07 12:47 AM |
c++ in linux kernel | Pekka Enberg | 2010/06/07 04:35 AM |
c++ in linux kernel | Michael S | 2010/06/07 04:54 AM |
c++ in linux kernel | Pekka Enberg | 2010/06/07 05:17 AM |
c++ in linux kernel | Michael S | 2010/06/07 05:50 AM |
c++ in linux kernel | Pekka Enberg | 2010/06/07 05:57 AM |
c++ in linux kernel | Vincent Diepeveen | 2010/06/23 05:10 AM |
c++ in linux kernel | ? | 2010/06/24 01:22 AM |
c++ in linux kernel | nemlis | 2010/06/30 06:56 AM |
c++ in linux kernel | Mark Christiansen | 2010/06/07 08:11 AM |
c++ in linux kernel | Neo | 2010/06/29 08:56 PM |
Poor troll, try harder next time (NT) | Matt Sayler | 2010/06/30 05:48 AM |
c++ in linux kernel | Rohit | 2010/06/30 07:10 AM |
c++ in linux kernel | gallier2 | 2010/06/07 05:43 AM |
c++ in linux kernel | Michael S | 2010/06/07 06:07 AM |
c++ in linux kernel | gallier2 | 2010/06/07 06:35 AM |
c++ in linux kernel | Michael S | 2010/06/07 08:15 AM |
c++ in linux kernel | gallier2 | 2010/06/07 11:50 PM |
c++ in linux kernel | ? | 2010/06/07 10:31 PM |
c++ in linux kernel | Michael S | 2010/06/08 12:39 AM |
c++ in linux kernel | ? | 2010/06/08 01:33 AM |
c++ in linux kernel | Michael S | 2010/06/08 05:38 AM |
c++ in linux kernel | ? | 2010/06/08 07:23 AM |
c++ in linux kernel | Michael S | 2010/06/08 08:52 AM |
c++ in linux kernel | EduardoS | 2010/06/08 02:13 PM |
c++ in linux kernel | CodeGrunt | 2010/06/12 10:19 AM |
c++ in linux kernel | newbie | 2010/06/06 08:04 AM |
c++0x any better? | Max | 2010/06/06 04:33 PM |
c++0x any better? | anon | 2010/06/07 07:32 PM |
c++0x any better? | Michael S | 2010/06/08 01:02 AM |
c++ in linux kernel | LispLover | 2010/06/06 09:46 PM |
c++ in linux kernel | Rob Thorpe | 2010/06/08 10:24 AM |
c++ in linux kernel - more disadvantages | Vincent Diepeveen | 2010/06/08 04:55 AM |
c++ in linux kernel | someone | 2010/06/08 08:22 AM |
c++ in linux kernel | John Regehr | 2010/06/10 10:59 AM |
c++/java in linux kernel | iirekm | 2010/06/11 07:02 AM |
c++/java in linux kernel | anon | 2010/06/11 07:20 AM |
c++/java in linux kernel | iirekm | 2010/06/11 07:38 AM |
c++/java in linux kernel | Rob Thorpe | 2010/06/11 10:17 AM |
Java is not just syntactic sugar on top of assembly | Mark Roulo | 2010/06/11 11:31 AM |
no it is :-) | iirekm | 2010/06/11 12:47 PM |
no it is :-) | Mark Roulo | 2010/06/11 02:19 PM |
no it is :-) | iirekm | 2010/06/12 03:06 AM |
no it is :-) | Gabriele Svelto | 2010/06/14 02:32 AM |
c++/java in linux kernel | anon | 2010/06/11 07:33 PM |
c++/java in linux kernel | ? | 2010/06/11 08:41 AM |
c++/java in linux kernel | EduardoS | 2010/06/11 06:21 PM |
c++/java in linux kernel | anon | 2010/06/11 07:34 PM |
C is more portable than assembly? | ? | 2010/06/11 10:59 PM |
C is more portable than assembly? | anon | 2010/06/12 12:15 AM |
C is more portable than assembly? | ? | 2010/06/12 02:50 AM |
C is more portable than assembly? | anon | 2010/06/13 03:24 AM |
c++ in linux kernel | Bob | 2014/05/24 10:40 AM |
c++ in linux kernel | Aaron Spink | 2010/06/06 04:20 PM |
c++ in linux kernel | Richard Cownie | 2010/06/07 07:49 AM |
c++ in linux kernel | anon | 2010/06/07 03:17 PM |
c++ in linux kernel | Richard Cownie | 2010/06/07 03:51 PM |
c++ in linux kernel | Aaron Spink | 2010/06/07 06:19 PM |
c++ in linux kernel | Richard Cownie | 2010/06/07 08:06 PM |
c++ in linux kernel | Mark Roulo | 2010/06/08 06:56 AM |
very interesting case study, thanks (NT) | Richard Cownie | 2010/06/08 07:57 AM |
Okay, wait, let me get that straight | Timmy | 2010/06/21 08:07 PM |
Split codebase.. | Anon | 2010/06/21 09:47 PM |
Okay, wait, let me get that straight | Richard Cownie | 2010/06/21 11:23 PM |
Okay, wait, let me get that straight | anonymous | 2010/06/22 12:34 AM |
Okay, wait, let me get that straight | Max | 2010/06/22 02:08 AM |
Okay, wait, let me get that straight | Gabriele Svelto | 2010/06/22 03:51 AM |
Okay, wait, let me get that straight | hobold | 2010/06/22 05:47 AM |
Okay, wait, let me get that straight | Salvatore De Dominicis | 2010/06/22 06:00 AM |
Okay, wait, let me get that straight | Richard Cownie | 2010/06/22 05:19 AM |
Okay, wait, let me get that straight | Mark Roulo | 2010/06/22 08:26 AM |
Okay, wait, let me get that straight | Rob Thorpe | 2010/06/22 01:04 PM |
Okay, wait, let me get that straight | Mark Roulo | 2010/06/22 08:21 AM |
Okay, wait, let me get that straight | EduardoS | 2010/06/22 02:07 PM |
c++ in linux kernel | anon | 2010/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 All | anon | 2010/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 All | hobold | 2010/06/08 04:33 AM |
Programmers Need To Learn Statistics Or I Will Kill Them All | Mark Roulo | 2010/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 All | Mark Roulo | 2010/06/08 07:56 AM |
To kill programmers just ship them to Tomtom - Gestapo methods there (NT) | Vincent Diepeveen | 2010/06/08 06:55 AM |
c++ productivity | anon2 | 2010/06/08 06:57 AM |
c++ productivity | Linus Torvalds | 2010/06/08 08:49 AM |
c++ productivity | Rob Thorpe | 2010/06/08 10:38 AM |
c++ productivity | D.P. | 2010/06/08 01:25 PM |
c++ productivity | Linus Torvalds | 2010/06/08 08:27 PM |
c++ productivity | anon2 | 2010/06/09 11:32 AM |
c++ productivity | Mark Roulo | 2010/06/09 01:15 PM |
C with pointer checking | Max | 2010/06/09 02:05 PM |
C with pointer checking | D.P. | 2010/06/09 10:06 PM |
C with pointer checking | Max | 2010/06/10 12:56 PM |
C with pointer checking | D.P. | 2010/06/10 01:16 PM |
DIE FORTRAN, DIE | Rohit | 2010/06/10 04:50 AM |
DIE FORTRAN, DIE | a reader | 2010/06/10 06:20 AM |
DIE FORTRAN, DIE | hobel | 2010/06/10 09:05 AM |
DIE FORTRAN, DIE | D.P. | 2010/06/10 01:17 PM |
c++ productivity | D.P. | 2010/06/09 09:49 PM |
c++ productivity | Maxthon T. Chan | 2013/09/19 11:02 AM |
c++ productivity | Walter Bright | 2010/06/10 09:30 AM |
c++ productivity | D.P. | 2010/06/10 01:28 PM |
c++ productivity | Nick Sabalausky | 2010/06/10 02:54 PM |
c++ productivity | D.P. | 2010/06/10 08:57 PM |
c++ productivity | Walter Bright | 2010/06/11 10:15 AM |
c++ productivity | D.P. | 2010/06/11 01:26 PM |
c++ productivity | Jesse Phillips | 2010/06/11 02:58 PM |
c++ productivity | Walter Bright | 2010/06/11 06:15 PM |
c++ productivity | D.P. | 2010/06/13 09:31 PM |
c++ productivity | Nick Sabalausky | 2010/06/13 10:19 PM |
c++ productivity | Walter Bright | 2010/06/14 09:38 AM |
c++ productivity | D.P. | 2010/06/15 03:18 AM |
c++ productivity | Nick Sabalausky | 2010/06/11 08:41 PM |
Context-dependency considered harmful? | ? | 2010/06/10 09:36 AM |
c++ productivity | Alok | 2010/06/10 04:21 PM |
c++ productivity | Linus Torvalds | 2010/06/10 06:00 PM |
c++ productivity | anon | 2010/06/10 07:07 PM |
c++ productivity | Eva | 2010/06/11 03:02 AM |
c++ productivity | Oh Come On Dept | 2010/06/11 10:07 AM |
c++ productivity | Linus Torvalds | 2010/06/11 11:17 AM |
c++ productivity | Mark Christiansen | 2010/06/11 12:16 PM |
c++ productivity | Linus Torvalds | 2010/06/11 04:35 PM |
c++ productivity | stubar | 2010/06/11 07:39 PM |
c++ productivity | a reader | 2010/06/12 05:30 AM |
c++ productivity | Gabriele Svelto | 2010/06/14 04:18 AM |
c++ productivity | Brad Cantrell | 2010/06/14 07:54 AM |
c++ productivity | ? | 2010/06/13 09:36 AM |
c++ productivity | Jouni Osmala | 2010/06/14 02:01 AM |
c++ productivity | EduardoS | 2010/06/14 01:46 PM |
c++ productivity | Timmy | 2010/06/18 09:26 AM |
c++ productivity | EduardoS | 2010/06/18 01:59 PM |
c++ productivity | rwessel | 2010/06/18 03:06 PM |
c++ productivity | EduardoS | 2010/06/19 07:31 AM |
c++ productivity | rwessel | 2010/06/21 11:50 AM |
c++ productivity | Anon | 2010/06/21 09:54 PM |
c++ productivity | Mark Roulo | 2010/06/22 08:10 AM |
c++ productivity | EduardoS | 2010/06/22 02:34 PM |
c++ productivity | Mark Roulo | 2010/06/22 02:51 PM |
c++ productivity | rwessel | 2010/06/22 12:42 PM |
c++ productivity | Anon | 2010/06/22 05:05 PM |
c++ productivity | rwessel | 2010/06/22 05:45 PM |
c++ productivity | hobel | 2010/06/23 03:36 AM |
c++ productivity | rwessel | 2010/06/23 12:19 PM |
c++ productivity | Rob Thorpe | 2010/06/23 04:42 PM |
c++ productivity | hobel | 2010/06/24 02:12 AM |
c++ productivity | Michael S | 2010/06/23 03:44 AM |
c++ productivity | rwessel | 2010/06/23 11:33 AM |
c++ productivity | Michael S | 2010/06/23 01:27 PM |
c++ productivity | rwessel | 2010/06/23 02:25 PM |
c++ productivity | Michael S | 2010/06/23 11:37 PM |
c++ productivity | rwessel | 2010/06/24 12:19 PM |
c++ productivity - apology | rwessel | 2010/06/23 11:37 AM |
c++ productivity | Rob Thorpe | 2010/06/23 04:34 PM |
c++ productivity | Mark Roulo | 2010/06/23 05:11 PM |
c++ productivity | Rob Thorpe | 2010/06/23 05:25 PM |
c++ productivity | Anon | 2010/06/24 01:26 AM |
c++ productivity | anonymous | 2010/06/18 03:43 PM |
c++ productivity | tm | 2010/09/14 02:43 AM |
c++ productivity | gallier2 | 2010/09/14 03:41 AM |
c++ productivity | Oh Come On Dept | 2010/06/11 01:52 PM |
c++ productivity | Kagamin | 2010/06/11 03:21 AM |
c++ productivity | anon | 2010/06/11 07:29 PM |
c++ productivity | David Kanter | 2010/06/13 09:37 AM |
c++ productivity | Richard Cownie | 2010/06/13 01:24 PM |
c++ productivity | Charles | 2010/06/14 10:41 AM |
c++ productivity | Richard Cownie | 2010/06/14 12:06 PM |
well-designed C++ libraries | D.P. | 2010/06/16 09:49 AM |
boost sucks | anon | 2010/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 history | Charles | 2010/06/17 10:33 PM |
amount of ignorance to history | anon | 2010/06/17 11:17 PM |
amount of ignorance to history | Mark Christiansen | 2010/06/18 07:22 AM |
amount of ignorance to history | anon | 2010/06/18 08:39 AM |
Boost is being used to illustrate that good C++ is unreadable by most | Mark Roulo | 2010/06/18 08:40 AM |
amount of ignorance to history | D.P. | 2010/06/18 03:13 PM |
well-designed C++ libraries | anon | 2010/06/17 12:20 AM |
well-designed C++ libraries | D.P. | 2010/06/18 03:25 PM |
well-designed C++ libraries | anon | 2010/06/18 08:57 PM |
well-designed C++ libraries | D.P. | 2010/06/21 08:11 AM |
well-designed C++ libraries | Kagamin | 2010/06/19 07:27 AM |
Lack of features can be a feature | David Kanter | 2010/06/19 12:03 PM |
some features have global effects | Richard Cownie | 2010/06/19 12:44 PM |
some features have global effects | Timmy | 2010/06/20 09:11 AM |
c++ productivity | Rob Thorpe | 2010/06/14 08:31 AM |
c++ productivity | Kagamin | 2010/06/18 09:30 AM |
c++ productivity | fast | 2010/06/11 10:47 PM |