From: "Richard Danter" <radanter@googlemail.com>
To: Bart Van Assche <bart.vanassche@gmail.com>
Cc: Marco Stornelli <marco.stornelli@coritel.it>,
Embedded Linux mailing list <linux-embedded@vger.kernel.org>
Subject: Re: prevalence of C++ in embedded linux?
Date: Tue, 29 Jul 2008 12:39:56 +0100 [thread overview]
Message-ID: <f75c52840807290439r5638f987yec53ba63817939e8@mail.gmail.com> (raw)
In-Reply-To: <e2e108260807290150tabb95d8vd080c069aab5d24@mail.gmail.com>
2008/7/29 Bart Van Assche <bart.vanassche@gmail.com>:
> On Tue, Jul 29, 2008 at 9:40 AM, Marco Stornelli
> <marco.stornelli@coritel.it> wrote:
>> Like Linus Torvals said "...C++ is an horrible language" :)
>
> Some C++ language features are indeed not very elegant from a
> language-theoretic standpoint. But that doesn't matter when writing
> embedded software -- what matters is that C++ allows to make source
> code a lot more readable than the C programming language. And if you
> don't like the overhead introduced by features like exceptions or
> RTTI, you can still pass -fno-exceptions -fno-rtti to gcc.
IMHO choosing a language is like choosing any other tool to get a job
done. I wouldn't use a screwdriver to bang in a nail (um, actually, I
have and it ruined my screwdriver so I won't do it again) and same
goes for programming languages.
For low-level programming, such as kernels and device drivers, C and
some assembly is probably the right choice in most cases. That is not
to say that C++ or any other language could not be used. I know of at
least one OS written almost entirely in C++ (drivers were objects that
could be passed between devices to help them communicate with each
other, very neat).
Looking at something like graphics programming C++ makes a lot more
sense. It is natural to think of a window inheriting properties from
the widgets that implement it's functionality. Qt and wxWidgets are
good examples, or Swing for Java. But of course Motif and GTK are
written in C and work perfectly well too. I'm not sure how easy it is
to "inherit" in GTK but vaguely remember it was not exactly trivial in
Motif. To me at least C++ makes more sense here.
Scripts also have a very important role. I am probably in the minority
when I say that I like Tcl, but used for it's original purpose it is a
very useful language. There are many cases where I would chose to use
Tcl or Perl or sh scripts rather than C, C++ or Java.
The resources of the target system are also important. Many "embedded"
systems these days are as powerful, if not more so, than my laptop.
For these systems you have a lot of freedom. For others there may be
limited RAM, disk space or other resources. I am often asked about
removing Perl from the systems my customers use because of the large
disk footprint.
So let's not be too hasty to label any language as bad. Each was
developed to address a need. Trying to use the wrong language for a
particular purpose is the bad thing.
Rich
prev parent reply other threads:[~2008-07-29 11:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 15:43 prevalence of C++ in embedded linux? Robert P. J. Day
2008-07-28 15:54 ` Chris
2008-07-28 15:55 ` Jamie Lokier
2008-07-28 16:15 ` Domenico Andreoli
2008-07-28 17:30 ` Matthias Kaehlcke
2008-07-28 21:47 ` Ben Nizette
2008-07-29 5:42 ` Roberto A. Foglietta
2008-08-02 4:14 ` Ben Nizette
2008-07-29 7:40 ` Marco Stornelli
2008-07-29 7:51 ` Alexander Neundorf
2008-07-29 8:20 ` Bernd Petrovitsch
2008-07-29 8:35 ` Marco Stornelli
2008-07-29 8:58 ` Alexander Neundorf
2008-07-29 9:47 ` Bernd Petrovitsch
2008-07-29 20:08 ` Leisner, Martin
2008-07-30 4:46 ` Bart Van Assche
2008-07-30 10:25 ` Jamie Lokier
2008-07-30 11:04 ` Bart Van Assche
2008-07-30 11:58 ` Haavard Skinnemoen
2008-07-30 12:38 ` Jamie Lokier
2008-07-30 13:01 ` Haavard Skinnemoen
2008-07-30 12:48 ` Bernd Petrovitsch
2008-07-30 13:07 ` Jamie Lokier
2008-07-30 13:58 ` Bernd Petrovitsch
2008-07-30 10:16 ` Jamie Lokier
2008-07-29 8:50 ` Bart Van Assche
2008-07-29 11:39 ` Richard Danter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f75c52840807290439r5638f987yec53ba63817939e8@mail.gmail.com \
--to=radanter@googlemail.com \
--cc=bart.vanassche@gmail.com \
--cc=linux-embedded@vger.kernel.org \
--cc=marco.stornelli@coritel.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).