Re: [LAU] OT: C or C++?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Thursday, October 14, 2010 - 4:17 am

Josh Lawrence wrote:

> hi Erik, I'm glad you asked this question...I've always felt like a

This is an interesting point. Yes, the vast majority of the small
useful utilities that run on a Linux machine have historically
been written in C. In addition, OS kernels, device drivers and
speed critical tasks are usually written in C. That means that
any professional programmer or dilligent amateur programmer
should know C.

However, for the small user space utilities, C is not the only
game in town. As part of my day job I ocassionally write similar
small utilities to run on our kiosk style linux systems. However,
I rarely write these utilities in C; C is way too flawed and
unsafe a language.

Instead, I write these utilities in strict statically typed
functional languages like Ocaml and (more recently) Haskell.
These languages are higher level so I don't have to worry about
things like memory allocation and buffer overflows. They also
have safe strings which makes string processing far easier than
in C or C++. The standard libraries of these languages have
simple, easy and guaranteed safe handling of high level data
structures like lists and dictionaries so I don't have the
write them from scratch.

However, most of the features above are also shared by languages
such as Ruby and Python. The big difference is that Ocaml and
Haskell programs compile to native binaries (like C and C++) and
that the compilers for these languages have a much more strict
type checkers (ie they find coding errors) than C or C++. This
means that many classes of bugs are found at compile time rather
than at run time like they would be for Ruby/Python/etc. The
native binaries produced from Ocaml and Haskell programs also
tend to run siginificantly faster than byte code interpretted
programs written in Ruby/Python/etc.

> also, I've noticed that at my local school most of the computer

As you might guess from what I've written in this thread, I am
quite interested in programming langauge research. From what I
have seen of this feild, the vast majority of programming
language centered computer science research (ie PhD research
and papers in reviewed journals) is done around Haskell and to
a lesser extent Ocaml.

In summary, since your interest seems to be in improving your
knowledge about Linux and how your machine works, C is definitely
the language to look at. However, C has many traps, requires
strict attention to detail and can be rather unforgiving. Higher
level langauges like Python, Ruby, Ocaml and Haskell allow you
to concentrate more on the problem than on the details.

Good luck.

Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] OT: C or C++?, Josh Lawrence, (Wed Oct 13, 8:42 pm)
Re: [LAU] OT: C or C++?, Josh Lawrence, (Fri Oct 15, 12:26 am)
Re: [LAU] OT: C or C++?, Ken Restivo, (Thu Oct 21, 12:12 am)
Re: [LAU] OT: C or C++?, Atte André Jensen, (Mon Oct 18, 10:25 am)
Re: [LAU] OT: C or C++?, James Morris, (Thu Oct 14, 1:30 am)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 1:17 am)
Re: [LAU] OT: C or C++?, Josh Lawrence, (Thu Oct 14, 3:06 am)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 4:17 am)
Re: [LAU] OT: C or C++?, Ng Oon-Ee, (Thu Oct 14, 5:49 am)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 8:40 am)
Re: [LAU] OT: C or C++?, Tim Clewlow, (Thu Oct 14, 12:28 am)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 1:05 am)
Re: [LAU] OT: C or C++?, Tim Clewlow, (Thu Oct 14, 1:37 am)
Re: [LAU] OT: C or C++?, david, (Thu Oct 14, 8:50 am)
Re: [LAU] OT: C or C++?, Arnold Krille, (Wed Oct 13, 11:00 pm)
Re: [LAU] OT: C or C++?, , (Wed Oct 13, 10:03 pm)
Re: [LAU] OT: C or C++?, Folderol, (Wed Oct 13, 10:11 pm)
Re: [LAU] OT: C or C++?, , (Wed Oct 13, 10:55 pm)
Re: [LAU] OT: C or C++?, Robin Gareus, (Wed Oct 13, 10:32 pm)
Re: [LAU] OT: C or C++?, Bjoern Lindig, (Thu Oct 14, 6:25 pm)
Re: [LAU] OT: C or C++?, Robin Gareus, (Thu Oct 14, 7:23 pm)
Re: [LAU] OT: C or C++?, Philipp Überbacher, (Thu Oct 14, 3:17 pm)
Re: [LAU] OT: C or C++?, Gabriel M. Beddingfield, (Wed Oct 13, 9:16 pm)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 1:11 am)
Re: [LAU] OT: C or C++?, Joshua Boyd, (Thu Oct 14, 3:27 pm)
Re: [LAU] OT: C or C++?, Erik de Castro Lopo, (Thu Oct 14, 8:14 pm)
Re: [LAU] OT: 2 minute intro to type systems (was C or C++?), Erik de Castro Lopo, (Thu Oct 14, 8:44 pm)
Re: [LAU] OT: 2 minute intro to type systems (was C or C++?), Erik de Castro Lopo, (Fri Oct 15, 10:51 am)
Re: [LAU] OT: 2 minute intro to type systems (was C or C++?), Philipp Überbacher, (Fri Oct 15, 6:30 am)
Re: [LAU] OT: 2 minute intro to type systems (was C or C++?), Harry Van Haaren, (Thu Oct 14, 9:23 pm)
Re: [LAU] OT: C or C++?, Bernardo Barros, (Thu Oct 14, 4:08 pm)
Re: [LAU] OT: C or C++?, Nick Dokos, (Thu Oct 14, 3:50 pm)
Re: [LAU] OT: C or C++?, Gabriel M. Beddingfield, (Thu Oct 14, 3:55 pm)
Re: [LAU] OT: C or C++?, R. Mattes, (Thu Oct 14, 4:39 pm)
Re: [LAU] OT: C or C++?, Gabriel M. Beddingfield, (Thu Oct 14, 5:02 pm)
Re: [LAU] OT: C or C++?, Kris Calabio, (Thu Oct 14, 5:22 pm)
Re: [LAU] OT: C or C++?, Philipp Überbacher, (Thu Oct 14, 6:10 pm)
Re: [LAU] OT: C or C++?, R. Mattes, (Thu Oct 14, 8:36 pm)
Re: [LAU] OT: C or C++?, Philipp Überbacher, (Fri Oct 15, 7:13 am)
Re: [LAU] OT: C or C++?, Simon Wise, (Fri Oct 15, 11:28 am)
Re: [LAU] OT: C or C++?, R. Mattes, (Fri Oct 15, 9:31 am)
Re: [LAU] OT: C or C++?, Dave Phillips, (Fri Oct 15, 10:23 am)
Re: [LAU] OT: C or C++?, James Morris, (Fri Oct 15, 7:43 am)
Re: [LAU] OT: C or C++?, david, (Fri Oct 15, 7:21 am)
Re: [LAU] OT: C or C++?, Philipp Überbacher, (Fri Oct 15, 7:45 am)
Re: [LAU] OT: C or C++?, david, (Sun Oct 17, 8:53 am)
Re: [LAU] OT: C or C++?, Kris Calabio, (Thu Oct 14, 8:05 pm)
Re: [LAU] OT: C or C++?, Bernardo Barros, (Thu Oct 14, 8:09 pm)
Re: [LAU] OT: C or C++?, Ken Restivo, (Thu Oct 21, 12:17 am)
Re: [LAU] OT: C or C++?, Folderol, (Thu Oct 14, 9:22 pm)
Re: [LAU] OT: C or C++?, Veronica Merryfield, (Thu Oct 14, 8:40 pm)
Re: [LAU] OT: C or C++?, Orcan Ogetbil, (Thu Oct 14, 8:23 pm)
Re: [LAU] OT: C or C++?, R. Mattes, (Thu Oct 14, 8:52 pm)
Re: [LAU] OT: C or C++?, Philipp Überbacher, (Fri Oct 15, 6:55 am)
Re: [LAU] OT: C or C++?, , (Thu Oct 14, 9:20 pm)
Re: [LAU] OT: C or C++?, Brett McCoy, (Thu Oct 14, 9:16 pm)
Re: [LAU] OT: C or C++?, Orcan Ogetbil, (Thu Oct 14, 9:05 pm)
Re: [LAU] OT: C or C++?, R. Mattes, (Thu Oct 14, 9:19 pm)
Re: [LAU] OT: C or C++?, Orcan Ogetbil, (Thu Oct 14, 9:43 pm)
Re: [LAU] OT: C or C++?, Chris Cannam, (Thu Oct 14, 9:23 am)
Re: [LAU] OT: C or C++?, Gabriel M. Beddingfield, (Thu Oct 14, 2:50 pm)
Re: [LAU] OT: C or C++?, Charles , (Wed Oct 13, 10:11 pm)
Re: [LAU] OT: C or C++?, Charles Henry, (Wed Oct 13, 10:07 pm)