To C or not to C, that is the question...

N

napi

Hello everyone,

I'm using Linux since quite a while now and I'm happy to notice that I'm
beginning to "know my way round". I can write little bash, sed and awk
scripts to help me with my everyday tasks and I've also had a thorough
look at Python, which is ideally suited for helping me with my work,
which is linguistic research, i.e. mainly text processing.

However, this does not seem to be of much use in understanding and
modifying source code of Linux applications, 90% of which seem to be
written in C. I do not want to write revolutionary new programs, I'd just
like to look under the hood of some Linux apps and perhaps write a little
patch here and there to adapt them for my purposes and, in this way,
maybe even contribute back to the Open Source community one day.

The problem is, C doesn't look at all like the newbie-friendly "written
pseudo-code" walk-in-the-park that is Python! Variable declarations,
pointers, memory allocations... I'm scared! My main concern is: Is it
even feasible for me to learn enough C for the above purposes in my
restricted spare time (which would be pretty much 8 PM till 8 AM! ;) or
should I leave that to the computer science students and full-time Linux
hackers?

I would be glad if you could tell me about your own experiences with C --
and whether I should or shouldn't learn it from your point
of view.

I learned C because I wanted to know how to do stuff systems
programmers do.
Much like why one is intrigued by the understanding of how things work
and be
able to create stuff. The thing about C is that it provides high
level language
features so that you are less error prone while at the same time be
able to touch
the guts of the machine and do something with it.

Cheers.

Napi
 
R

Rehceb Rotkiv

Thanks very much for your tips! As most of you recommended, I'll get K&R
and see where I can get with it.

Rehceb
 
M

Malcolm McLean

Barry said:
My comment was not about the quality of K&R2, but your
statement that someone could be an adequate C programmer
in a month. I am sure we will get some comments from other
folks, and I expect them to agree with me. If I am wrong I
apologize up front.
There is guy on comp.lang.c lisp who claimed to have one day's experience
and was posting perfectly adequate lisp code with lambda functions and the
like.
I've recently learnt lisp. Whilst it only took a few minutes to "get it", to
actually use it took several days, partly because I had to set up the
environment myself, partly because it is just so difficult for an
imperative-type person like me to rewrite everything as recursive calls. I
still haven't done anything useful with it, so I would still classify myself
as in the learning stage.

This poster was working in a financial institution. He seemed to have some
job involving share dealing. Those jobs tend to be very lucrative and
attract extremely able people. I can believe he was telling the truth.
 
P

per9000

[...] linguistic research, i.e. mainly text processing [...]

I started working in Python during a final thesis - I worked with
databases, regular expressions and so on. If that is what you want
than I'd recommend you to stick to Python since it is awesome for
processing text - I am learning C more and more because it's closer to
where all the action is (pointers to memory and stuff) but I find it
in no way as user friendly as Python is.

ALSO: I work a lot in .NET (C#) (that is available on all systems
thanks to the MONO project). I have made some small, silly
applications that integrates the console and the windows trash-can for
example (it takes about 3-7 lines of code to send a file to the
trashcan in C#). I recently started wondering if that is possible to
do the same things in C. It most likely is but I have no idea of where
to start looking for the code/packages/etc to integrate C and the
trashcan.

[...] However, this does not seem to be of much use in understanding and
modifying source code of Linux applications, 90% of which seem to be
written in C. [...]


Indeed - to me this is really interesting stuff - I have looked at
some source code to f.x. grep, I have looked at it for two minutes and
hardly understand anything. Still: this interests me and I am
determine to learn more about it. So I recently bought "Linux
Programming For Dummies" http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0764506919.html
- I have not read it yet but I hope it'll give me a crash course to
stuff I want to know.

[...] or
should I leave that to the computer science students and full-time Linux
hackers? [...]


I do not consider myself a code guru but I enjoy C. It's a little like
learning latin before learning french. I see C as the mother of all
languages - and if you know how pointers work in C you will understand
Python better. In case you didn't know it: Python is written in C and
that has to mean C is good, right?

I would be glad if you could tell me about your own experiences with C --
and whether I should or shouldn't learn it from your point
of view.


I'd say: do your research in Python - that way you will save a lot of
time, at least initially. But learn C to understand the core of
Python, Linux, etc.

Also: the Python community (at least the python-usenet list) is as I
see it a more friendly place than the C community (at least compared
to this list). Here you can get hanged for top-posting. On the Python
list (most) people are friendly.

HTH,

Per
[:)]-|--<

--

Per Erik Strandberg
..NET Architect - Optimization
Tomlab Optimization Inc.
http://tomopt.com/tomnet/
 
?

=?iso-8859-1?q?Lars_Rune_N=F8stdal?=

I would be glad if you could tell me about your own experiences with C
-- and whether I should or shouldn't learn it from your point of view.

Gnome now has/accept Python software as part of their "official"
components.

C is still very useful to know though.
 
P

per9000

<snip>


I also bought C All-in-One Desk Reference For Dummies
http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0764570692.html
and that one I *have* read - it's friendly way of getting to know a
little more about C. But not a complete way - it lacks a lot of topics
(f.x. call-backs).

Also like most (American ?) litterature it's talky (you might want a
book with more code and less talk).

/Per

--

Per Erik Strandberg
..NET Architect - Optimization
Tomlab Optimization Inc.
http://tomopt.com/tomnet/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top