why still use C?

C

cody

C supports the const keyword now.

since when? C99?
typedef struct X {
// public data members
} X;

in C is the same as

struct X {
// public data members
};

in C++.

and in function declarations? is void foo(X x){} allowed?
 
J

Jalapeno

"cody said:
no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially C++.

Because there is an ANSI/ISO C compiler for my Apple IIgs and there
isn't a compiler for C++. Not all of us program for the x86 platform. I
prefer the WDC65C816.
 
J

Jerry Feldman

no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially
C++.
I'd just like to add my 2 $.025.
C++ is a very tool rich language and is wonderful for application level
and some systems level jobs. C is excellent for many lower level
programming jobs. I would certainly use C++ for graphical programming
and any other type of programming where one should deal with objects.

It all comes under the heading of "use the right tool for the job". When
comparing C to C+ I think of C as assembler language and C++ as the high
level language, and there are some tasks where assembler language is
appropriate.
 
J

John Bode

Speaking for myself and no one else...

cody said:
no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially C++.

Main reasons:

1. It's required. I'm supporting code that, for one reason or
another, was originally written in C, and porting it to C++ or
anything else is far more effort than it's worth.

2. C is a smaller language than C++, and learning to use it
effectively is a bit more straightforward than learning to use C++
effectively. Once you actually understand OOP, C++ pretty much falls
into place, but IME there's a longer flailing period with C++ (YMMV).
 
G

gswork

cody said:
no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially C++.

For small portable utilities it really is rather good, for larger
projects it can get a little confusing if you don't set about things
well. C++ can be nice there - but then you have to watch what you're
doing as it can be a minefield.

C Compilers are plentiful and often very good, ISO C is portable and
widely implemented, there's lots of third party libraries (though that
can be confusing!).

You can structure your C code so as to be efficient for the machine -
not what you're always 'supposed' to do, but it's an option. Many C
compilers are capable of significant optimisation too.

C++ and it's STL are a nice way to accomplish many things too though,
nothing you couldn't do it C, but sometimes clearer and less
troublesome (for me as someone of relatively low skill in both!)

And then there's code size, embedded apps....
i heard people say C++ is slower than C but i can't believe that.

intuitively i'd imagine all the safety nets might slow some parts
down, other than that i suspect there's no meaningful difference.
 
T

thp

+ no this is no trollposting and please don't get it wrong but iam very
+ curious why people still use C instead of other languages especially C++.
+
+ i heard people say C++ is slower than C but i can't believe that. in pieces
+ of the application where speed really matters you can still use "normal"
+ functions or even static methods which is basically the same.
+
+ in C there arent the simplest things present like constants, each struct and
+ enum have to be prefixed with "struct" and "enum". iam sure there is much
+ more.
+
+ i don't get it why people program in C and faking OOP features(function
+ pointers in structs..) instead of using C++. are they simply masochists or
+ is there a logical reason?
+
+ i feel C has to benefit against C++.

C is pretty much, but not quite, a sublanguage of C++. C programmers
who don't use the non-C++ features of C are programming in C++ whether
they claim to or not. They are restricting themselves to an older,
more established, more easily learned, and more easily implemented
subset of C++. But they are writing in C++ --- non-idiomatic C++, but
C++ nevertheless. AFAIK, a C++ compile is free to generate the same
code for those programs as would a C compiler, so there is no
intrinsic difference in performance.

Compiling C programs with a C++ compiler has the benefit that C++
compilers are required to perform intermodule type checking. But I'm
told that this intermodule type checking is a curse when one tries to
use precompiled libraries that have been compiled on different C++
compilers, since that checking is usually based on name-mangling and
there is no name-mangling standard. (Perhaps others have more
experience with that issue.)

Tom Payne
 
D

Dan Pop

In said:
is "const float PI=3.14" possible in plain C?

If you're not aware of the basic standard C features, what makes you
think that you're qualified to participate to this discusion?

Dan
 
M

Mike Wahler

Attribution restored:

Cody:

First, I will initially take at face value your statement
that you are not trolling. Let's see what happens after
you read the following:

I'm writing this because you probably do not realize
that Mr. Klein is one of the select few people here
who are the most highly qualified to help people to
learn and work with with the C language, as well as
to explain its various strengths and weaknesses, and
to help you decide if C is the most appropriate tool
for a particular task.

Strictly speaking, only discussion of the language itself
is topical here, but if treated with respect, I suspect
Jack would probably extend his aid regarding those last
two issues as well.

Of the people who have replied to you, I consider Jack
and Richard Heathfield to be very far "above the crowd"
with regard to knowledge and skill with the C language.
I suspect most others here will agree.

If you want quality help and information about C, you
can hardly do better than to listen to these two gentlemen.

Let's review. See below.
in comp.std.c:

i see you have very much problems

I fail to see Jack expressing any "problems" in what he wrote
above. He asked legitimate questions about the statements
you made. He did not attack you, insult you, or call you
bad names. Nor did he shower you with love and praise.

His questions were neutral, and in my opinion designed
to cause you to stop and think. He can only answer to
what you wrote, because as far as I know, he cannot read
minds, and I know from experience here that he will not
simply assume meanings or motives you did not express.

So when you say:
i see you have very much problems

I can only answer: How do you know he has problems?

and:
with people who are criticize

I answer: Assuming for the moment that he does "have
a problem with your criticism," how can you know whether
or not he "has problems with people who criticize?"
Do you claim knowledge of his interactions with everyone?

and:
your favourite programming language.

I answer: How can you know if C is or is not his
favorite language?
when you have a problem with that nobody forces you to discuss here with us.


what makes you believe that?

Probably the part of your post to which it responded,
which you did quote, but I reproduce here:
in pieces of the application where speed really matters
you can still use "normal" functions or even static methods
which is basically the same.

in C there arent the simplest things present like constants,
each struct and enum have to be prefixed with "struct" and
"enum". iam sure there is much
more.

Jack replied as he did because he *knows* that:

1. C does not assign an attribute of "normal" or "abnormal"
to functions.

2. C does not define anything called a "static method" or a
"method".

3. A function can indeed be declared as "static", but this
attribute is not defined to have any effect at all upon
performance.

4. The qualities of a nonstatic function are *not* the same
as those of a static function. Where applied to a function,
the "static" keyword causes its scope and linkage to differ
from one where it is not.

5. Nothing at all about speed of performance is specified
by the C language.

6. C does indeed specify a keyword 'const' and its effect
when applied. A constant can also be expressed with a
macro.

7. structure object types are defined using the 'struct' keyword
and enumeration types are defined using the 'enum' keyword.
Your sole implied reason for expressing dissatisfaction with
these syntactical rules is that they differ from that of
another language. C is not C++, nor does it make any attempt
to be.

You make six erroneous assertions or implications about C,
and also complain that C is not C++. Then you say "I'm sure
there is much more."

It is not clear to me whether you mean "much more" about
C which you do not know, or "much more" about C you do
not like. More which you do not know, I would hesitate
to deny, given the several false statements you made.
More which you do not like, I do not doubt at all. That
last is your opinion, not a fact which can be refuted or
denied, so it doesn't matter what anyone thinks about that.


You repeated statements said by others and gave your
judgement about them. You gave no bases for such a
judgment. So Jack asked for your premises. You responded
by attacking him. Then you make or imply assertions
of your own, again providing no premises for them.


Another logical question, again probably designed to
cause to to stop and think about what you wrote.
No personal attacks. (Despite the belief to the
contrary by many, ignorance is not a character flaw,
it's simply a lack of education about one or more
subjects, easily rectified, and without any reason
for shame or embarrassment.)

Jack is extremely qualified to assess one's knowledge
or ignorance about the C language. He has accurately
assessed yours, and validly challenges your criticism
of it. (Actually he didn't need that reason anyway,
since this group is *specifically designated* for
*discussion* of C, not for advocacy or criticism of it.)

I believe I have reasonable knowledge of C, but not
perfect, and sometimes I write something here about C
which is wrong. When Jack sees this he corrects me.
I respond with *thanks*, not by attacking him for
pointing out my errors.
Or is your wisdom to be

Perhaps this remark is justified, perhaps not. It seems
that your irrefutable ignorance about C, combined with
your expression of conclusions without premises might
have caused him to associate your nonfluency with English
with your level of wisdom.

I can understand this reaction, since when you wrote your
first post, (in this English-speaking newsgroup), you did not
indicate that English is not your native language, and
unfortunately, a significant number of people whose native
language *is* English post here with spelling, grammar,
etc. far worse than yours.

The content of your post combined with the poor English
probably caused him to believe you were an American
or British troll.
dont be childish.

Jack is certainly not childish. My many years of interaction
with him here tell me this. How long have *you* been here?
i didn't troll so you shouldn't do this either.

Despite your disclaimer, your message gives every evidence
of being a troll. For now, I give you the benefit of the
doubt. Jack is certainly no troll, but once of the more
highly regarded and valued regular contributors here.

I suppose time will tell what your true character is.
when you feel my grammar or punktuation are wrong please point out the
passage and tell my what was wrong.

If you ask nicely, perhaps I'll do that for you.
Perhaps you might help me learn German. But not
here. Maybe in newsgroups about English and German.

Here, only C.
i'm german and my english is still not perfect.

I understand very little German, but my few halfhearted
attempts to learn it quickly informed me that many more
words are capitalized in German than in English; it seems
that every noun is capitalized (only my impression, I'm
not certain.) If your defense of your English is that
you're German, I would have expected too many capital
letters, not none at all. :)

My brief 'learning' experiences with German also indicates
that it uses punctuation as well. Is it true that the
only punctuation characters used consistently are periods
and apostrophes, and that commas are optional, as your
messages seem to show? Is it true that sentences are begun
in lower case?

I do see two indicators of a German learning English:
the British English spelling which uses 'ou' where the
American English uses only 'o' (meaning you probably
have more contact with British than Americans), and the
use of 'k' where all forms of English use 'c', 'k', or
'ck'.

[Restoring context for below]:

There is no single reason or set of reasons. The reasons
of some can and do differ from those of others. The
only way to know is to ask each person using C.

Why do you seem to believe that if a person uses C, that
that is the only language he uses? The average programmer
I come into contact with uses between three and six programming
languages on a regular basis. I'm acquainted with a few who
use only one, and others who use a dozen or more, but these
are the exceptions in my experience.

1. Why do you seem to feel that OOP is the solution to
all programming issues? Have you blindly believed
the 'mass media'?

2. OOP can be done in virtually any language. Why do
you feel that using a given language's available features
to implement OOP is somehow 'fake'?

3. Why do you believe that the insertion of a pointer to
a function into a structure causes the use of that
structure and its function pointer member(s) to become
a component of OOP or OOP itself?

4. Are you unaware of the several other concepts and
techniques which comprise OOP?

Why do you believe that C++ is the only language which
has features and constructs which directly support OOP?
are they simply masochists

I doubt it. More likely they're rational, logical people
applying appropriate tool(s) to particular task(s) And
personally, I find C a joy to use. I feel the same way
about C++.

I embrace *both* languages, I don't pit them against
one another. Sometimes I combine the two, drawing upon
the strengths of each and/or overcoming limitations of
each, to create useful applications.

You probably have a tool box in your garage. What's
inside? Just a hammer? Just a screwdriver? I suspect
it contains a variety of useful tools. This concept
does not disappear in the programming world.

I suspect there are many. But I won't presume to present the
reasons of others. I've told you mine.

I'll guess you've made a typing error here and really
meant:

"i feel C has no benefit against C++."

You're certainly entitled to that opinion. Nobody
has tried to force you to use C and/or to refrain
from using C++, have they? So your expression of
this "feeling" here will garner no sympathy or support.
All we can tell you is to use any language you like.
prove that my thaughts are illogical.

I believe I've done that above. I've done this with the
intention of helping you. I'm curious as to how you will
react.
the same is true for forth,fortran,cobol,pl/1 but does that mean it is
reasonable
to use these languages today?

That question implies that you've decided it means it is not.
But you've just agreed that the same (age, past and current
success) is true for those languages. It seems you've
just contradicted yourself, as well as made another conclusion
without premises. Does age somehow override success?

Are you saying that when a programming language reaches a
certain age it becomes obsolete or 'unreasonable to use'?
Why? Have you never considered the *domain* of a particular
language? Are you unaware of the concept of "existing code
base?" Simple economics?

I've used all of the languages you cite during my career
except Forth, and many more. I use and like C++ very
much. But I don't use it as a basis to criticize C or
any other language. I'm uncertain about PL/1, but I *know*
that FORTRAN and COBOL are still widely used today. I don't
know if it's still true today, but not very long ago, COBOL
represented the vast majority of existing code. Much, perhaps
most of it is still being used without complaint or problem.

Would you have people throw away perfectly good code
which *already performs its task satisfactorily*
and write it all over again from scratch? Expend the
resources for design alterations often necessary when
moving to a new language? For testing and debugging?
For the extra hardware probably required for the necessary
"run in parallel" period? In a pointless, misguided quest
to be "modern?"

What about systems for which a C++ implementation is
not available? For which only an implementation of
a single language (C for example) is available?
What about the fact that among these single-language-
available systems, the language with the highest
probability of being that single one is C?

Also, why would people expend the effort to continue to
update COBOL and FORTRAN standards if nobody found them
'reasonable' to use? Or did you assume that these languages,
which you label by implication "ancient, obsolete, useless",
were abandoned by everyone in favor of languages like C++,
simply because they're more recently invented?

Are you suffering from the misconception that any given
single language is or can be the solution to all programming
issues?

Jack's remark about the age of C was meant to show that
it has withstood the "test of time", and is still a very
useful and powerful tool. In my opinion, the same is
true of FORTRAN and COBOL, and I suspect will also be
of C++ (which imo has alredy proven its power, we'll
still be in the "time test" period for a while yet).
that is a fact i already learned in this discussion. and your first
argument.

Jack has successfully refuted much of what you've stated.
It would be in your best interest to listen to him if
you care to learn what C really is. Even if you find
his mode of communication not to your absolute satisfaction,
you could learn much from him. I certainly have.

If you want to discuss or learn about C, this is the place.
If you want to criticize it or compare it with other languages,
this is not the place.

This is a key point.
nor does it have to

what is wrong with comparing languages?

Doing it here is wrong because it's not topical here.

Doing it in proper context could indeed be a fruitful
exercise. But before you do, I strongly suggest you
base your side of a debate upon accurate knowledge,
and to the extent possible, experience, not hearsay
and speculation.


There. I feel better now. :)

-Mike
 
M

Mike Wahler

Micah Cowan said:
Possibly... added to the list of people allowed to pass through
his not-a-spammer?-then-confirm-yourself filter...?

Ah, could be. In which case I'll take that as a compliment. :)

-Mike
 
R

Richard Bos

Mike Wahler said:
First, I will initially take at face value your statement
that you are not trolling.

I've just seen some of "cody"'s posts in another programming newsgroup,
and have come to the conclusion that it _is_ a troll.

Richard
 
C

cody

First, I will initially take at face value your statement
I've just seen some of "cody"'s posts in another programming newsgroup,
and have come to the conclusion that it _is_ a troll.


what??? what makes you think that?
 
C

cody

that's what i call an answer :)
First, I will initially take at face value your statement
that you are not trolling. Let's see what happens after
you read the following:

I'm writing this because you probably do not realize
that Mr. Klein is one of the select few people here
who are the most highly qualified to help people to
learn and work with with the C language, as well as
to explain its various strengths and weaknesses, and
to help you decide if C is the most appropriate tool
for a particular task.

i didn't know who he was i only knew how he reacted to my
question and his answer seemed to me a bit aggressive.
Jack replied as he did because he *knows* that:

1. C does not assign an attribute of "normal" or "abnormal"
to functions.

2. C does not define anything called a "static method" or a
"method".

i mean't "why C instead of C++". i assumed all C programmers would use C++
and so i said that this is no problem since in C++ they cann still use
c-functions
or static functions as they are the same as c-functions, basically.

iam sorry if i didn't made that clearer.
6. C does indeed specify a keyword 'const' and its effect
when applied. A constant can also be expressed with a
macro.

i didn't knew that.
Another logical question, again probably designed to
cause to to stop and think about what you wrote.
No personal attacks. (Despite the belief to the
contrary by many, ignorance is not a character flaw,
it's simply a lack of education about one or more
subjects, easily rectified, and without any reason
for shame or embarrassment.)

iam not an ignorant. why do you think i asked this question?
i only wanted reasons why people still use C. ok now i have got enough
reasons.

- C is simpler than C++
- some people don't like OOP
- some people don't want to learn OOP
- some projects don't need OOP
- some platforms dosn't provide a proper C++ compiler.

i didn' know that i would create such a large discussion.
Perhaps this remark is justified, perhaps not. It seems
that your irrefutable ignorance about C, combined with
your expression of conclusions without premises might
have caused him to associate your nonfluency with English
with your level of wisdom.

I can understand this reaction, since when you wrote your
first post, (in this English-speaking newsgroup), you did not
indicate that English is not your native language, and
unfortunately, a significant number of people whose native
language *is* English post here with spelling, grammar,
etc. far worse than yours.

so what do you advise? should i write in the subject of my next posting:

"warning! german poster with probably wrong capitalization, punctuation and
grammar"
The content of your post combined with the poor English
probably caused him to believe you were an American
or British troll.

i didn't know that my english is so bad. i would be very grateful if
somebody give me a hint what is wrong with my grammar.
I understand very little German, but my few halfhearted
attempts to learn it quickly informed me that many more
words are capitalized in German than in English; it seems
that every noun is capitalized (only my impression, I'm
not certain.)

that is correct all nouns, proper names and beginnings of a sentence are
capitalised.
If your defense of your English is that
you're German, I would have expected too many capital
letters, not none at all. :)

you underestimated my lazyness :-[=]
My brief 'learning' experiences with German also indicates
that it uses punctuation as well. Is it true that the
only punctuation characters used consistently are periods
and apostrophes, and that commas are optional, as your
messages seem to show?

some commas in german are optional.

Is it true that sentences are begun in lower case?

neither in english nor in german but my shiftkey is broken.
i brough is to the workshop last week but it is still not ready :)
1. Why do you seem to feel that OOP is the solution to
all programming issues? Have you blindly believed
the 'mass media'?

no, but you can use C++ without programming OOP sinc C++ is a hybrid
language
which supports various programming paradigms, including structured,oop,
functional and more.
2. OOP can be done in virtually any language. Why do
you feel that using a given language's available features
to implement OOP is somehow 'fake'?

oop need language support at least to a certain level. when people programm
oop in C then it is certainly faked.
3. Why do you believe that the insertion of a pointer to
a function into a structure causes the use of that
structure and its function pointer member(s) to become
a component of OOP or OOP itself?

it was just an example how some people fake oop in c.
4. Are you unaware of the several other concepts and
techniques which comprise OOP?

yes. i have good knowlegde about c++,c# and java. a OO-language needs
classes,ctors,dtors,virtual,abstract,static methods and access modifiers.
i consider operator overloading as optional.

does C++ have a concept of sealed classes? that are classes which cannot be
subclassed.
Why do you believe that C++ is the only language which
has features and constructs which directly support OOP?

surely not. it was just an example cos c++ is the successor of c.
You probably have a tool box in your garage. What's
inside? Just a hammer? Just a screwdriver? I suspect
it contains a variety of useful tools. This concept
does not disappear in the programming world.

thats what i meant. why use a tool or another when you have a tool which
combines both?
why use C when you can use C++ which contains C? thats what i meant. you can
use c++,
nobody will force you to use its additinal features.
I believe I've done that above. I've done this with the
intention of helping you. I'm curious as to how you will react.

iam indeed grateful as you pointed out that my question was misunderstood
here.
i was wondering why some people didn't understand it, now i know why.
Are you saying that when a programming language reaches a
certain age it becomes obsolete or 'unreasonable to use'?
Why?

no, i'm not saying that.
Have you never considered the *domain* of a particular
language? Are you unaware of the concept of "existing code
base?" Simple economics?

nobody will throw away C. it still exists in C++ as C++ is fully backward
compatible(at least C94 if iam correctly informed)
Would you have people throw away perfectly good code
which *already performs its task satisfactorily*
and write it all over again from scratch? Expend the
resources for design alterations often necessary when
moving to a new language? For testing and debugging?
For the extra hardware probably required for the necessary
"run in parallel" period? In a pointless, misguided quest
to be "modern?"

surely not.
Are you suffering from the misconception that any given
single language is or can be the solution to all programming
issues?

surely not.
If you want to discuss or learn about C, this is the place.
If you want to criticize it or compare it with other languages,
this is not the place.

i wanted to learn about C why people still use it and now i know why :)
There. I feel better now. :)

me to..

now i know why iam always misunderstood here: it certainly is my bad grammar
:)
 
C

cody

is "const float PI=3.14" possible in plain C?
If you're not aware of the basic standard C features, what makes you
think that you're qualified to participate to this discusion?


who are you to determine who can participate here and who not?
i just determined you are a very rude &$§"$"!/§$") and
do not deserve to discuss here.
 
W

Wolfgang Riedel

- C is simpler than C++
- some people don't like OOP
- some people don't want to learn OOP
- some projects don't need OOP
- some platforms dosn't provide a proper C++ compiler.
why use C when you can use C++ which contains C? thats what i meant. you can
use c++,
nobody will force you to use its additinal features.
nobody will throw away C. it still exists in C++ as C++ is fully backward
compatible(at least C94 if iam correctly informed)

ad 2)
just do it, if 1) or policy is no showstopper

ad 3)
not true (and easily found out by googling f.e. this ng
or http://www.google.com/search?hl=de&ie=ISO-8859-1&client=googlet& \
q=c+%22c%2B%2B%22+++compatibility&btnG=Google+Suche&lr=).

There's a whole series of articles by B. Stroustrup about pros and cons of making
them more compatible:
http://www.cuj.com/documents/s=8011/cuj0207stroustr/ ff.

a "german poster with probably wrong capitalization, punctuation and grammar"
 
W

Wolfgang Riedel

cody said:
If you're not aware of the basic standard C features, what makes you
think that you're qualified to participate to this discusion?

who are you to determine who can participate here and who not?
i just determined you are a very rude &$§"$"!/§$") and
do not deserve to discuss here.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

you might find out ...
after being plonked by everybody knowledgeable.

*plonk*
 
C

CBFalconer

cody said:
.... snip ...

neither in english nor in german but my shiftkey is broken.
i brough is to the workshop last week but it is still not ready :)


no, but you can use C++ without programming OOP sinc C++ is a
______________________^_______________________^^^______^

Nothing broken, but showing that you fail to capitalize I and the
beginning of sentences purely to annoy. You are rapidly
approaching PLONK status, which will harm you if some time you
really want information.
 
C

CBFalconer

cody said:
who are you to determine who can participate here and who not?
i just determined you are a very rude &$§"$"!/§$") and
do not deserve to discuss here.

That does it. PLONK.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top