What is the advantage of C?

  • Thread starter lovecreatesbea...
  • Start date
L

lovecreatesbea...

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

And what are its disadvantages?
 
S

Serve Laurijssen

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

And what are its disadvantages?

C will get you women.
Might be a disadvantage if you are in fact a woman and not lesbian but it is
the general consensus that C gets you lots of women
 
D

David Wade

Serve Laurijssen said:
C will get you women.
Might be a disadvantage if you are in fact a woman and not lesbian but it is
the general consensus that C gets you lots of women
May also be a problem if in fact you are a gay male and don't want a women
either....
 
D

David Wade

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

And what are its disadvantages?
P.S. just stick:-

"What is the advantage of C language?"

into google. Plenty of hist and info...
 
R

Richard Heathfield

(e-mail address removed) said:
Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are?

C has the same advantage as strawberry ripple ice cream. It exists.

Some people prefer other flavours. Some people like several different
flavours. Some people even like to mix their flavours together.

The most important thing about C is its Cness. For people who like it, it's
exactly the right taste, with just that tang, and just that zest.

Some people want to change the flavour of C, because it doesn't taste like
the flavour they like best. This is like demanding that strawberry ripple
should taste more chocolate-chip; i.e. stupid.
What are its pleasant,
expressive and versatile characteristics?

Partly the strawberryness and the ripplosity, partly the cold, and partly
the creamitude.
And what are its disadvantages?

It isn't chocolate-chip. (And so what?)
 
M

Malcolm

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

And what are its disadvantages?
The most important advantage is that a C compiler exists for almost every
platform in existence. There is also a huge body of code.
It is about the "cleanest" of all the high level so-called second-generation
languages. It has enough syntax to make programs readable, but no more.

The main disadvantage is that there is no support for object-orientation. If
you want to use OO really you have to use another language like java or C++.
The other disadvantage is so-called "undefined behaviour". It would be
possible to define the result of every illegal operation as terminating the
program with an error message, but this wasn't done for efficiency reasons.
Which means that a buffer overrun could cause the wrong output rather than a
segmentation fault. If input is cleverly constructed, it could even cause
malicious code to be executed.
 
S

santosh

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

It's well tested, extensively ported and concise. It's close enough to
the machine to let you write efficient code, (provided you're on your
toes), but abstracted enough to be very portable. It's relatively terse
syntax appeals to many programmers. IMHO, it has remained the best
choice of language for the purpose for which it was originally designed
- constructing system software.
And what are its disadvantages?

The answer to this question would be highly subjective and variable.
Personally I feel that C is done a disservice by it's preprocessor
language. It's about time it was improved.
 
C

CBFalconer

Richard said:
(e-mail address removed) said:


C has the same advantage as strawberry ripple ice cream. It exists.

Some people prefer other flavours. Some people like several different
flavours. Some people even like to mix their flavours together.

The most important thing about C is its Cness. For people who like it,
it's exactly the right taste, with just that tang, and just that zest.

Before C became standardized and included prototypes, I couldn't
stand it at all. The original K&R flavor was much too error prone.

--
Some informative links:
< <http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
 
C

CBFalconer

Malcolm said:
The most important advantage is that a C compiler exists for almost
every platform in existence. There is also a huge body of code.
It is about the "cleanest" of all the high level so-called
second-generation languages. It has enough syntax to make programs
readable, but no more.

Actually it is neither as clean nor as portable as Pascal. However
it is significantly more flexible, and as you said, compilers exist
for practically every system.

I would much rather create, from scratch, a Pascal system than a C
system. Today this is not necessary, because of basically portable
compilers such as gcc. As a very rough measure of compiler
complexity needed, compare the size of the Pascal standard with
that of the C standard. And don't even mention C++.

--
Some informative links:
< <http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
 
C

CBFalconer

santosh said:
(e-mail address removed) wrote:
.... snip ...


The answer to this question would be highly subjective and variable.
Personally I feel that C is done a disservice by it's preprocessor
language. It's about time it was improved.

Fundamentally impossible, due to the strictures of the great god
"backward compatibility".

--
Some informative links:
< <http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
 
M

Malcolm

CBFalconer said:
Actually it is neither as clean nor as portable as Pascal. However
it is significantly more flexible, and as you said, compilers exist
for practically every system.

I would much rather create, from scratch, a Pascal system than a C
system. Today this is not necessary, because of basically portable
compilers such as gcc. As a very rough measure of compiler
complexity needed, compare the size of the Pascal standard with
that of the C standard. And don't even mention C++.
Pascal decided to pretend that the machine doesn't work in binary.
It is very easy to build a Turing tarpit. For instnace, if you go to my
website you can download a little program called "cellular automaton". In
theory, and given the limits of its screen, it can compute any computable
function.
Some day I will get round to writing a little routine for it to add two
numbers together. In practise, that is about the limit that you will be able
to achieve with it.
 
M

Malcolm

CBFalconer said:
Before C became standardized and included prototypes, I couldn't
stand it at all. The original K&R flavor was much too error prone.
C has always been the least bad programming language.
There probably is a way to tell a computer what to do, simply, clearly and
without any real possibility of error, but we haven't found it. Experiments
are interesting, but have tended to make the problems worse.
 
P

Paul Connolly

CBFalconer said:
Actually it is neither as clean nor as portable as Pascal. However
it is significantly more flexible, and as you said, compilers exist
for practically every system.

I would much rather create, from scratch, a Pascal system than a C
system. Today this is not necessary, because of basically portable
compilers such as gcc. As a very rough measure of compiler
complexity needed, compare the size of the Pascal standard with
that of the C standard. And don't even mention C++.
I learned Pascal years ago and have followed the Wirth languages Modula-2
Oberon - very interesting - i like Wirth's minimalist philosophy but he is
developing in isolation - the only trouble is that any operating systems
that matters are written in C (or C++).
 
C

CBFalconer

Paul said:
I learned Pascal years ago and have followed the Wirth languages
Modula-2 Oberon - very interesting - i like Wirth's minimalist
philosophy but he is developing in isolation - the only trouble is
that any operating systems that matters are written in C (or C++).

I think Wirth went wrong in eliminating i/o from the language when
advancing to Modula from Pascal. The change did add a measure of
flexibility, but made programming much less natural. The
advantages of the pseudo-variadic write/read in Pascal are many.
It produces the flexibility of variadic functions without the
insecurities. In some ways the stream i/o of C++ is a return to
that, but with much less clarity. In this respect Modula and C are
very similar.

--
"The mere formulation of a problem is far more often essential
than its solution, which may be merely a matter of mathematical
or experimental skill. To raise new questions, new possibilities,
to regard old problems from a new angle requires creative
imagination and and marks real advances in science."
-- Albert Einstein
 
R

Richard Heathfield

CBFalconer said:
Before C became standardized and included prototypes, I couldn't
stand it at all. The original K&R flavor was much too error prone.

I have but rarely tasted that language, and I don't like the taste at all.
But there will be some who liked that flavour, and are sorry to see it go.
And, even without liking it, I too am sorry to see it go, for our diversity
is diminished by its passing.
 
K

Keith Thompson

CBFalconer said:
I think Wirth went wrong in eliminating i/o from the language when
advancing to Modula from Pascal. The change did add a measure of
flexibility, but made programming much less natural. The
advantages of the pseudo-variadic write/read in Pascal are many.
It produces the flexibility of variadic functions without the
insecurities. In some ways the stream i/o of C++ is a return to
that, but with much less clarity. In this respect Modula and C are
very similar.

The ideal solution, I think, is to design a language so the I/O
statements have the same ease of use as Pascal, *but* are defined as
ordinary library routines without using any special-case language
features.

C does this with printf(), but only by giving up type checking.
(Other languages do various other off-topic things.)
 
R

Rod Pemberton

Could you extract examples of the characteristics of C itself to
demonstrate what the advantages of C are? What are its pleasant,
expressive and versatile characteristics?

This is a history lesson from my personal experiences. Despite it being a
bit long, I hope you take the time to read it.

I've programmed in a number of languages: C, PL/1, 6502 assembly, x86
assembly, FORTH, Pascal, Fortan, BASIC, etc.(fourteen total). I haven't
experienced newer languages like C++, PHP, Java, etc., or object oriented
ones: C++, Smalltalk. Given that, two of the things I value most in a
language are: 1) ease of programming and 2) pointers (which correspond to
addresses in assembly). Most of the languages I've experienced, fail both
of those. The exceptions are: C, PL/1 (or PL/I), FORTH and, perhaps, Pascal
(today).

PL/1, a precursor to Pascal, was basically Pascal (with pointers, like C),
and record structures that were supposedly based on COBOL. One big
difference was that variables were passed by reference. This _greatly_
eased programming. In hundreds of thousands of lines of code I wrote, there
were only two situations where I had to tell the compiler to pass by value.
Unlike C, one (basically) never had to be concerned about whether you were
passing in a value or an pointer to a function or procedure... Strings were
a fundamental type, but due to the way they were implemented for the machine
I programmed, I still viewed them as problematic.

FORTH is syntax free and not usually taught in academic settings. The
biggest problems are that 1) you have to think in terms of objects on the
stack like assembly, 2) you have to learn RPN, 3) the default words are
somewhat cryptic if you don't know assembly, and 4) you can't usually
generate compiled code. The last one is a big disadvantage. It's
interpreted like BASIC, so development is quick. That is an advantage.

Assembly can be trying, because there usually isn't an easy method to create
named variables or larger data types likes structures. In assembly,
everything is referenced by register name or memory address. So, where is
my loop counter? Did I put it in eax, esi, memory, zero page (6502
reference...)... Did it get relocated or saved by the linked C code?

FORTRAN, as I experienced it, which was a few decades ago, was a complete
****ing nightmare. The only thing good about it was that numerical results
were accurate... Otherwise, I can't say anything good about it at all.
Hopefully, Fortran has been heavily modified since then.

Pascal, when I learned it, had limited pointer functionality. It was an
example of safe programming practices like Java. For the most part, the
language was easy to learn but didn't seem powerful (which I attribute to
the lack of actual pointers and inability to access the OS). Apparently, a
more complete type of pointer was added in the early '90's with a new
standard.

BASIC had the easiest method of string manipulation. This is the thing I
remember the most about BASIC. It was so easy, that I usually create the
MID$,LEFT$,RIGHT$, and a concatenation function when I'm programming in
languages other than C. C has less easy to use duplicate funtionality. The
other thing I remember is how much quicker it was to test and develop
programs. Compiling and running C over, and over again, is much slower.

As for C, it isn't as easy as Pascal, it can't do strings as easy as BASIC,
it is slower to develop in than BASIC or FORTH, it can't pass data as easy
as PL/1, but it captures the abilities of most early CPU's and modern RISC
CPU's. It's real strength is the closeness of it's featureset to assembly
language, named variables, and pointers. It's not that it's standardized or
somewhat portable or whatever excuse the others here want to promote.
And what are its disadvantages?

In addition to what I mentioned above,

1) There is no way to determine from a pointer in C what data it is pointing
to. You can point it to one variable and then reuse it to point into the
middle of another. This can cause programming errors and prevents
optimizations by the C compiler. (Yes, unfortunately, one of my preferred
language features is a hindrance to compiler advancement.)

2) C is frequently implemented using a single stack. This means that flow
control information (if, while, procedures, etc.) is stored on the same
stack as data. This allows for various stack overflow/underflow exploits or
programmer error.

etc...


Rod Pemberton
 
C

Charles Richmond

Richard said:
CBFalconer said:


I have but rarely tasted that language, and I don't like the taste at all.
But there will be some who liked that flavour, and are sorry to see it go.
And, even without liking it, I too am sorry to see it go, for our diversity
is diminished by its passing.
Amen! <IMHO> C is supposed to be a sharp and incisive tool. One
must be careful in using C lest one wound oneself badly. This
will foster care and thoughtfulness in those who use it...others
can get only pain from it. </IMHO>
 
C

Charles Richmond

CBFalconer said:
Actually it is neither as clean nor as portable as Pascal. However
it is significantly more flexible, and as you said, compilers exist
for practically every system.
The flexibility of C is preciesly what makes it dangerous. Pascal will
protect you in many ways, but C says "If you want to shoot yourself
in the foot, here, let me load the gun for you." Thus you must be
careful and do more thinking about what you are doing in C.
I would much rather create, from scratch, a Pascal system than a C
system. Today this is not necessary, because of basically portable
compilers such as gcc.
The Pascal compilers I have seen the source for (PASCAL4 and PASCALS)
are recursive decent parsers, which is a straghtforward and clear
way to parse. ISTM that C can be implemented with recursive decent,
with some fix-ups...but most C compilers use stronger parsing methods.
As a very rough measure of compiler
complexity needed, compare the size of the Pascal standard with
that of the C standard.
ISTM that the C standard could be shorted by 80% if all the special
cases were eliminated. These cases were introduced to allow some
odd-ball implementations to squeak in under the standards fence.
For instance, just say "NULL is always 0". If you can *not* implement
NULL this way, go home and think about how to fix *your* implementation,
*not* change the standard.
And don't even mention C++.
IMHO C++ is *not* a language, it is an abomination. I have heard it
said that C is a sailboat and C++ is the Queen Mary. C++ is object
oriented, but it forces the programmer to create all the underpinnings
that support things. Compare C++ to any other object oriented
language and you will see what I mean.
 

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
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top