Richard heathfields C programming article

S

sophia.agnes

Hi,

I was going through Mr "Richard heathfields" site , it is written as
follows:-

Some people think C has no role to play in the modern programming
world. I would consider this opinion to have rather more validity if
it weren't for the fact that even those who express it use C code on a
daily basis (whether they realise it or not). C programs and libraries
are woven into the very fabric of the modern programming world, and
only a fool thinks otherwise.

Well Mr heathfield can you explain your statement in a clear & brief
manner, even my peers ask this question most of the time, so that i
can give them some good answers.

my colleagues always advice me on the following lines:-

1)C why learn it, it is of no use for ordinary programmers like us,it
is a language for nerds.

2) it has no role of C language in a windows development
environment...???(they say c is purely for *nix environment)

3) for ordinary programmers just knowledge of database design
concepts, SQL,SDLC, then a language like java or C# will earn the
bread and butter...???

now i have got my own questions

1) can any one point out good enough tutorials showing how to make gui
app in C(with the help of graphical libraries) just as we do in
java...???(no curses please, i don't like it)

2) I have heard that the java compiler javac is purely written in C
how true is this statement...???
 
D

dj3vande

Hi,

I was going through Mr "Richard heathfields" site , it is written as
follows:-

Some people think C has no role to play in the modern programming
world. I would consider this opinion to have rather more validity if
it weren't for the fact that even those who express it use C code on a
daily basis (whether they realise it or not). C programs and libraries
are woven into the very fabric of the modern programming world, and
only a fool thinks otherwise.

Well Mr heathfield can you explain your statement in a clear & brief
manner, even my peers ask this question most of the time, so that i
can give them some good answers.

my colleagues always advice me on the following lines:-

1)C why learn it, it is of no use for ordinary programmers like us,it
is a language for nerds.

There are a lot of good reasons, but one of them is that it forces you
to learn to think about programming in a way that will be useful with
any other language you use as well.

Two major ways that it does this are:
(a) It forces you to understand what you're doing at a fundamental
level; C doesn't have any built-in high-level abstractions, so if
you want them you have to build your own. Having done this a few
times will make it a lot easier to understand what's going on
underneath when you're using a language that has them pre-built for
you.
(b) It forces you to learn to get your programs right, by not
protecting you from your errors. If you get things wrong, the
program will break in subtle and unsubtle ways, and you will often
need to understand how your program works, even in parts that
aren't directly related to where the bug is showing up (which you
already should by the time you run into runtime problems!), to find
out what really went wrong.

2) it has no role of C language in a windows development
environment...???(they say c is purely for *nix environment)

My day job involves writing code that gets deployed on Windows, and a
lot of that is done in C. In fact, most of the bits of the code that
everybody hates to have to poke at are written in languages other than
C, so my experience would indicate that C is one of the *better*
languages for developing under Windows (though I'm not going to claim
that that's representative).

3) for ordinary programmers just knowledge of database design
concepts, SQL,SDLC, then a language like java or C# will earn the
bread and butter...???

That depends what kind of job you want to get. It's probably unwise to
restrict the tools you learn to use to only those that are currently
useful for getting a job for "ordinary programmers", though, since
those tools tend to change over time and having a broader knowledge
base both makes you more likely to know *something* that's useful at
any given time and makes it easier to pick up new tools as they come
along.

now i have got my own questions

1) can any one point out good enough tutorials showing how to make gui
app in C(with the help of graphical libraries) just as we do in
java...???(no curses please, i don't like it)
1-57231-995-X


2) I have heard that the java compiler javac is purely written in C
how true is this statement...???

I would be unsurprised to find that javac is implemented (at least
partly) in Java, but the JVM that it would run on in that case is
almost definitely written in C.


dave
 
S

Szabolcs Nagy

1)C why learn it, it is of no use for ordinary programmers like us,it
is a language for nerds.
not true
see wide usage in industry
(well probably it's not used much for gui or highlevel web application
development, but saying it is for nerds only is definitely not true)
2) it has no role of C language in a windows development
environment...???(they say c is purely for *nix environment)
c standard tries to be as platform independent as possible for a
lowlevel language (c has compilers for microcontrollers as well as
supercumputers)
3) for ordinary programmers just knowledge of database design
concepts, SQL,SDLC, then a language like java or C# will earn the
bread and butter...???
sure if your job is to manipulate databases from c# or java then it's
ok

when you have to roll your own fileformat/data structures/etc then
you'll have hard time with those languages (most dbms systems,
webservers, compilers etc are written in c)

also when you need fast data processing those languages can fail
(memory management issues, speed, ..)
1) can any one point out good enough tutorials showing how to make gui
app in C(with the help of graphical libraries) just as we do in
java...???(no curses please, i don't like it)
i don't know, but i guess every c gui toolkit has it's own tutorials/
documentation (gtk comes to mind, though most toolkits are written in c
++ nowdays)
2) I have heard that the java compiler javac is purely written in C
how true is this statement...???
sure, check out the src code which is available: http://download.java.net/jdk6/6u5/archive/

also python, perl, ruby, ghc haskell,.. compilers are written mostly
in c
 
R

Richard Heathfield

(e-mail address removed) said:
Hi,

I was going through Mr "Richard heathfields" site , it is written as
follows:-

Some people think C has no role to play in the modern programming
world. I would consider this opinion to have rather more validity if
it weren't for the fact that even those who express it use C code on a
daily basis (whether they realise it or not). C programs and libraries
are woven into the very fabric of the modern programming world, and
only a fool thinks otherwise.

Well Mr heathfield can you explain your statement in a clear & brief
manner,

If the above is not clear enough and brief enough for you, I'm afraid I
can't oblige.
even my peers ask this question most of the time, so that i
can give them some good answers.

my colleagues always advice me on the following lines:-

1)C why learn it, it is of no use for ordinary programmers like us,it
is a language for nerds.

Find out what they mean by "nerds". I'm just an ordinary programmer like
you, and I find that C is of a great deal of use to me.
2) it has no role of C language in a windows development
environment...???(they say c is purely for *nix environment)

I write far more C for Windows than I do for Linux. Most of the time I
don't care which OS my code runs on, but when I *do* care, the reason
tends to be that I am accessing the Win32 API. So, for me, C has a very
important role in Windows development.
3) for ordinary programmers just knowledge of database design
concepts, SQL,SDLC, then a language like java or C# will earn the
bread and butter...???

If all you want to do is earn bread and butter, go get a job as a baker or
a dairymaid.
now i have got my own questions

1) can any one point out good enough tutorials showing how to make gui
app in C(with the help of graphical libraries) just as we do in
java...???(no curses please, i don't like it)

I wasn't /going/ to curse.

"Programming Windows", 5th edition, by Charles Petzold, is an excellent
tutorial in Windows programming (although, alas, the C itself is a bit
dire). This work might reasonably be regarded as canonical. I don't know
what the canonical Linux equivalent is, but several decent books on GTK
exist. (And GTK has been ported to Windows, so you can kill two birds with
one stone if you like.)
2) I have heard that the java compiler javac is purely written in C
how true is this statement...???

I don't know, but I would not be surprised if it were true. Many compilers
are partly "written" using tools that generate lexing and parsing code,
and this code is typically generated in C, so a typical modern compiler is
likely to be at least partly written in C.
 
M

Mark Bluemel

2) I have heard that the java compiler javac is purely written in C
how true is this statement...???

There are probably javac implementations written in C, but the reference
implementation from Sun is entirely written in Java, last time I looked.
 
M

Mark Bluemel

I would be unsurprised to find that javac is implemented (at least
partly) in Java, but the JVM that it would run on in that case is
almost definitely written in C.

Or C++ (much of Sun's "Hotspot" implementation), or Java (Jalapeno), or
something else ...
 
P

Philip Potter

Mark said:
Or C++ (much of Sun's "Hotspot" implementation), or Java (Jalapeno), or
something else ...

But presumably Jalapeno then has to run on *another* virtual machine :)
 
P

Philip Potter

Hi,

I was going through Mr "Richard heathfields" site , it is written as
follows:-

Some people think C has no role to play in the modern programming
world. I would consider this opinion to have rather more validity if
it weren't for the fact that even those who express it use C code on a
daily basis (whether they realise it or not). C programs and libraries
are woven into the very fabric of the modern programming world, and
only a fool thinks otherwise.

Well Mr heathfield can you explain your statement in a clear & brief
manner, even my peers ask this question most of the time, so that i
can give them some good answers.

my colleagues always advice me on the following lines:-

1)C why learn it, it is of no use for ordinary programmers like us,it
is a language for nerds.

2) it has no role of C language in a windows development
environment...???(they say c is purely for *nix environment)

3) for ordinary programmers just knowledge of database design
concepts, SQL,SDLC, then a language like java or C# will earn the
bread and butter...???

These three questions all kind of imply one question: "Is C a good
language?" or "Is C better than <other language>?"

This is actually an FAQ in the comp.lang.c++ FAQ, though it is almost as
applicable to C:
http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.5

If all the programmers and all the managers within an organisation use
C# or Java, then it makes sense for you to learn C# or Java too. If
everyone uses C, then you should use C. Speaking the same language as
your colleagues is /much/ more valuable than using the "best" language
for the job.

On the other hand, if you are interested in learning about programming
rather than just trying to get some job done, then C is an excellent
language to learn. It has many, many different applications: GUI code,
web servers, DSP processors, embedded devices (such as cars or mobile
phones), compilers and interpreters (including C compilers, the Perl
interpreter, games (from NetHack to Quake), and lots more. Once you know
C, you have a tool which can be used in all these fields.

I have known C for a long time, but I've only just started working on
embedded processors and C is the language of choice for my particular
processor (the Xilinx MicroBlaze soft processor). My previous experience
writing C for Windows and Linux applications meant I didn't have to
waste time learning a new language.

Phil
 
J

James Kuyper

Hi,

I was going through Mr "Richard heathfields" site , it is written as
follows:-

Some people think C has no role to play in the modern programming
world. I would consider this opinion to have rather more validity if
it weren't for the fact that even those who express it use C code on a
daily basis (whether they realise it or not). C programs and libraries
are woven into the very fabric of the modern programming world, and
only a fool thinks otherwise.

Well Mr heathfield can you explain your statement in a clear & brief
manner, even my peers ask this question most of the time, so that i
can give them some good answers.

Since he declined to expand on his statement, I'll give a stab at it.
Even people who never read or write a single line of C code are
constantly using tools that were written in C. The system utilities are
often written in C. In many cases the compilers for other languages are
written in C. In many cases compilers for other languages produce C code
as an intermediate step before using a C compiler to create the actual
executable. Even people who never go near a computer terminal are
constantly using devices that have small computers embedded in them that
the user is probably unaware of, and those embedded computers are often
running programs written in C, or at least in a variant of C.

I think Richard Heathfield may have gone too far by calling the people
who are unaware of this "fools". If the use of C is well hidden (and I
think every one of the cases I described above is fairly well hidden
from the ordinary user), I don't think that people can be justifiably be
called fools just because they're unaware of it.
My father is a technophobe who probably doesn't even know what C is; but
I don't think that makes him a fool - he's fairly wise in many ways that
have nothing to do with computers. I have a brother who's president of a
large organization, who constantly uses computers in connection with his
business, but only as a user, never as a programmer. He might have heard
of C, but I doubt that he's aware of any of the facts I've given above,
and he's certainly not a fool.
 
R

Richard Heathfield

James Kuyper said:

Since he declined to expand on his statement, I'll give a stab at it.

I'd gladly have obliged if I could have done so more clearly and more
briefly than the original statement. I could not think of a way to do so.

But it's just as well that I didn't, since your reply raises an interesting
and important flaw in my original statement.

I think Richard Heathfield may have gone too far by calling the people
who are unaware of this "fools".

So does Richard Heathfield. I have recast the original statement as
follows:

"C programs and libraries are woven into the very fabric of the modern
programming world, and anyone who thinks otherwise betrays their ignorance
of that world."

Better?
 
J

James Kuyper

Richard Heathfield wrote:
....
So does Richard Heathfield. I have recast the original statement as
follows:

"C programs and libraries are woven into the very fabric of the modern
programming world, and anyone who thinks otherwise betrays their ignorance
of that world."

Better?

Yes.
 
P

Philip Potter

Richard said:
James Kuyper said:



I'd gladly have obliged if I could have done so more clearly and more
briefly than the original statement. I could not think of a way to do so.

Now you're just playing word games again. The offending request was:
> Well Mr heathfield can you explain your statement in a clear & brief
> manner,

He asked you to explain the statement. I take 'explain' to mean expand
upon, fill in the gaps, put in more details; which naturally implies
that the explanation will be longer than the statement. Thankfully, at
no point did the OP ask for an explanation shorter than the statement,
so this is indeed a perfectly possible task.

A 'brief explanation' can be longer than a statement, just as a 'small
elephant' can be larger than a dog.
 
R

Richard Heathfield

Philip Potter said:
Now you're just playing word games again.

No, I wasn't, although I agree that you make a valid point, below.
The offending request was:

Well, presumably you intend "offending" to be taken in the informal sense,
close to "relevant" in meaning. Certainly I wasn't offended by it.
He asked you to explain the statement. I take 'explain' to mean expand
upon, fill in the gaps, put in more details; which naturally implies
that the explanation will be longer than the statement. Thankfully, at
no point did the OP ask for an explanation shorter than the statement,
so this is indeed a perfectly possible task.

Indeed. Fortunately, James has now saved me the trouble. :)
A 'brief explanation' can be longer than a statement, just as a 'small
elephant' can be larger than a dog.

Although of course it depends on the size of the dog, and of the elephant.
It may even depend on the state of mind of the observer. I recall a Calvin
& Hobbes cartoon where a small wasp was chasing Calvin, and (in relation
to Calvin) it was drawn considerably larger than a dog. It may even have
been as large as a very, very small elephant.
 
M

Mark Bluemel

Szabolcs said:
i don't know what are you talking about

For a start I'm saying that, contrary to what you may think, there is
more than one implementation of javac and more than one implementation
of the Java Virtual Machine.

Some of these may be implemented in C but that by no means implies that
all of them are.
the full source of jdk 6 is available (i've already posted a link)
and it's written in c

That is one implementation - not the only one.

Even that is (probably) by no means entirely implemented in C. I have
worked extensively with Sun's "Hotspot" JDK codebase (I'm not sure
whether the link you pointed to is for HotSpot which is why I've added
"probably" above). Based on my exposure, though I didn't spend much time
on the core JVM, and as I recall :-

* large parts of the JVM implementation are written in C++, not C
* the class libraries are written in Java with supporting
native code written partially in C and partially in C++

As I've already pointed out - the Jalapeno JVM implementation is written
in Java.

Other JVM implementations may use other languages. I'm aware of one JVM
where the core bytecode interpreter was implemented in assembler.
 
S

Szabolcs Nagy

Mark said:
For a start I'm saying that, contrary to what you may think, there is
more than one implementation of javac and more than one implementation
of the Java Virtual Machine.
thanks now i see
i've never thought about sun implementing more than one jvm (does it
make sense?)
Other JVM implementations may use other languages. I'm aware of one JVM
where the core bytecode interpreter was implemented in assembler.
ok this makes sense (arm-11 jazelle is obviously faster than a c
implementation)
but otherwise it's not clear why they need more than one implementation
 
C

Charlton Wilbur

SA> my colleagues always advice me on the following lines:-

SA> 1)C why learn it, it is of no use for ordinary programmers
SA> like us,it is a language for nerds.

If they have no use for it, they should not learn it. It's a
programming language, not the secret to salvation.

On the other hand, if they learn it, they are likely to understand a
number of things better, and suddenly see lots of uses for it. But
it's their decision to make and their time to spend.

Why are you letting the uninformed opinions of other people dictate
what you study and what you learn?

SA> 2) it has no role of C language in a windows development
SA> environment...???(they say c is purely for *nix environment)

The Win32 API is a C API. Draw your own conclusions.

SA> 3) for ordinary programmers just knowledge of database design
SA> concepts, SQL,SDLC, then a language like java or C# will earn
SA> the bread and butter...???

You can get a paying computer job knowing only C# or Java and SQL,
yes. However, there's far more to life and to a career than merely
getting paid. Your colleagues need to consider job satisfaction as
well.

SA> 1) can any one point out good enough tutorials showing how to
SA> make gui app in C(with the help of graphical libraries) just
SA> as we do in java...???(no curses please, i don't like it)

GUIs are fairly complicated things. As hard as it is to write a
useful tutorial on C, it is even harder to write a useful tutorial on
GUI programming. You almost certainly won't find one online.

That said, choose a platform -- Windows and Win32, Apple and Carbon,
or a Unixlike and GTK, and research the second half of the pair.
You'll probably find more than enough to keep you occupied.

SA> 2) I have heard that the java compiler javac is purely written
SA> in C how true is this statement...???

I believe the source code for javac is publicly available now; look
for yourself and see.

Given what javac does, I don't think it can be written in
strictly-conforming standard C, but it wouldn't surprise me in the
slightest if it were written predominantly in C.

Charlton
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top