- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] C Gurus
- From: O Plameras <oscarp@xxxxxxxxxxx>
- Date: Tue, 22 Nov 2005 18:55:24 +1100
- User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)
On Tue Nov 22, 2005 at 17:43:49 +1100, O Plameras wrote:
I don't find C difficult at all.
On Tue Nov 22, 2005 at 16:52:06 +1100, O Plameras wrote:
C is a very difficult programming language to program in and get right.
(As seen in this thread). Programming errors in C are likely to lead
to buggy unstable, insecure software. Therefore if you program in C you
should try and get as much help from tools to ensure that what you have
programmed is correct. Some of those tools are:
... but you still didn't know how strings work.
C has one of the least number of
vocabularies to learn and master.
Yep that is true.
If you understand pointers and pointer arithmetic you have the right
stuff. So, learn pointers
and pointer arithmetic.
pointers and pointer arithmetic are very difficult concepts
for people to learn. They are important things to learn, but
most people find them difficult.
The problem with this statement is you generalize your point as if it is
written in stone for most people to put into their heads, which is
newbies out there are smarter than you think and given the right
they will be able to learn about Linux in particular and Open Source in
general quicker than you and me have.
Some people find it difficult to conceptualize pointers and pointer
which includes yourself I suppose because you kept on saying these are
to learn. You keep on telling yourself it is extremely difficult; and it
The reality of it all is anyone can learn C in one day and master it in
By this I mean, after one week anyone will be able to read anyone's C code
provided it is written correctly.
C is extremely good because many OSes and Compilers are written in C
including Linux itself
and many tools in Linux.
I would say C is good despite that ;). I never said C is bad, I said
it was difficult to program in well.
It is your mental attitude that makes you believe it is difficult.
Open Source is notoriously lacking in documentations. Unless you know C
you are lost and
you hardly can't proceed if you are doing a project.
That is simply untrue. There are many projects written purely in python,
Try writing a PHP module in these languages.
So, my advise to newbies in Linux, forget about people that discourages
you from writing in
C language. Use C and you will quickly realise the real beauty and
opportunities of Open Source.
It gives you more freedom and independence.
Hey, I agree. Learn it, and then learn when to use it and when to use
a higher level language.
The object of programming is to get what you want in a simple and easy
to understand programming.
Sure, that is why I prefer higher-level languages that provide more abstraction.
That's why my preferred the solution is
<snip function that returns a pointer to a stack>
This is tremendously simpler than what you have proposed, as ff:
<snip my previous solution>
I wasn't attempting to have something simpler, I was try to
give him what I'm thinking he was trying to do, but I'm not a
mind reader. I assumed that there was some reason for the
given structuring. Hell if I wanted to give him the simplist
solution to print out a string it would have been:
He was trying to print a string initialised from a function other than
I am discouraged by simply looking at these codes much more
bother to read it.
Well, that is sad.
The trouble other programmers have with C is that they make their
codes complicated than it should.
That is possible. With any language really knowing it means, knowing
the simplest and most clear way to achieve what you want.
I disagree with this. There are lots of things I can do with C that
cannot be done with
1/ Using the compilers warning system.
2/ Using something like valgrind to test for memory errors.
3/ Use a static analysis tool like splint.
(Apart from that C is a very unproductive language to program in, so
unless you really need it then use something higher level -- please!)
other high level languages easily.
Sure, and that is why I said "unless you really need to". For example
lets say you have some data in a file. With the format:
And you want the average of those numbers. Writing that in python
takes about 10 lines of code and about 1 minute, and you usually
get it right first time. Writing that in C with the standard library
is not so simple. And if that is too contrived think about large
complex open source problems like revision control and how most
of the latest ones are written in high level languages. Because
really, speed of the processor isn't an issue here, but good algorithms
And I challenge anyone to write a doubly linked list right the first
Anyway, you can write good stuff in C, but really, unless computation
speed is the issue you would do much better to write it in a higher level
language where you can spend time refining algorithms not worrying
about memory management.
(And really C sucks for device drivers and low level stuff too now I think about
it, its not as though C has a way to access x86 style ports, and its not
as though its structs are tightly defined enough so you can just use them
to describe device memory layouts, although people do and rely on how the
I do not know if you heard about the seven blind men who went to visit
in order to describe what an elephant is.