473,583 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why still use C?

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(functi on
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++.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05
687 23186
cody wrote:
no this is no trollposting
I will try to bear that in mind.
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.
Believe it. Or test it. For your test to be significant, be sure you use a
wide range of test programs, equivalently written in C and C++ (don't
bother with the so-called "C subset" of C++ - either write in C or write in
C++), on a wide variety of programs. Tabulate your results. (If they're
worth a damn, they're probably worth publishing, perhaps on your Web site
in the first instance.)
in
pieces of the application where speed really matters you can still use
"normal" functions or even static methods which is basically the same.
Suck it and see.
in C there arent the simplest things present like constants,

int main(void)
{
const int new = 6; /* I rest my case */
return 0;
}
each struct
and enum have to be prefixed with "struct" and "enum".
Poor baby.
iam sure there is
much more.
Yes, there is. C is simple, portable, and very very fast. Those are
important qualities.
i don't get it why people program in C and faking OOP features(functi on
pointers in structs..) instead of using C++. are they simply masochists or
is there a logical reason?
There is a logical reason. Encapsulation is a great idea for some projects
(not all, of course), so why not use it (when appropriate)? Note, also,
that a C program such as you describe doesn't "fake OOP features" - rather,
it uses OOP to achieve its objectives. That C, which was /not/ designed to
do OOP, /can/ be used for OOP is quite remarkable in itself. Having said
that, I am very much of the "if you want OOP and C++ is available, use C++"
school - but note that C++ is /not/ available on anything like as many
target platforms as C is.

i feel C has to benefit against C++.


It does have three important advantages. It's simple, portable, and fast.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #21
cody wrote:
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.
There is both a speed and size penalty for using C++ where
pain C would do. The penalty isn't as bad as it used to be.
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.
C has constants. We usually use typedefs rather than struct
and enum tags.
i don't get it why people program in C and faking OOP features(functi on
pointers in structs..) instead of using C++. are they simply masochists or
is there a logical reason?


It's very rare for C programs to "fake OOP features".

One of C's main benefits is that it is easier to implement
and has simpler run-time support requirements. This makes
it especially suited to embedded processors, for example.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #22
cody wrote:
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++.


C is available on nearly every machine. C++ is not. OOP is a nice thing
but not for everything.

"With OOP we can solve problems very elegant, we wouldn't have without
it."

While the above statement is not entirely true, there is some truth in it.
;)

/Sven

--
Remove the "-usenet" part of the mail address to mail me. The Gibe/Swen
worm forced me to shutdown my usenet email address for a limited time.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #23
In article <cl************ ****@plethora.n et>,
"cody" <NO************ ****@gmx.net> wrote:
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++.
C++ *is* C. Worse, it is an improper superset of C. Of all the things
you might advocate as an "alternativ e" to ANSI C, C++ is probably the
worst.
i don't get it why people program in C and faking OOP features(functi on
pointers in structs..) instead of using C++.


This is laughable. It is C++ that is best known for faking OO features!
If you're looking for an OO extension to C that is actually well done,
one that is additionally a proper superset of C, you should be looking
at Objective-C. But that's still in the C family. If you don't want C,
don't use C; don't use C++ and pretend you're not using C, though.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #24
cody wrote:
in C there arent the simplest things present like constants, each struct and
enum have to be prefixed with "struct" and "enum".


Neither of these is really true. "Real" integer constants can be
created using enums (or "#define"), and you can use "typedef" to avoid
having to write "struct" or "enum" everywhere if it bothers you, e.g.:

typedef enum { false, true } bool;

Jeremy.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #25
Hi all

My reason is simple: I have no time at the moment to learn C++ and C fits my
needs.

Well, I actually know something about C++, but I feel that you need a lot of
knowledke on C++ to be able to develop "big programs", I mean that there are
lots of things that need to be well understood, otherwise you are dead (you
know, lot of errors you can't find...)

"cody" <NO************ ****@gmx.net> escribió en el mensaje
news:cl******** ********@pletho ra.net...
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(functi on
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++.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et

--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #26
cody wrote:
I am very curious about why people still use C
instead of other languages, especially C++.
Fear of change.
I heard people say C++ is slower than C but I can't believe that.
Neither can I. In fact, I know it isn't true.
No one has *ever* shown an example of C code
which is faster that C++ (or slower than C code)
that actually performed the same computation.
The speed of the code emitted by either a C or C++ compiler
depends *only* upon the quality of the the compiler.
In pieces of the application where speed really matters,
you can still use "normal" [C] functions or even static methods
which is basically the same.
It doesn't matter.
In C, there aren't the simplest things present like constants,
C supports the const keyword now.
each struct and enum must be prefixed with "struct" and "enum".
typedef struct X {
// public data members
} X;

in C is the same as

struct X {
// public data members
};

in C++.
I am 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++.


They are *not* faking OOP features.
This is just the way that C programmers wrote object oriented programs
before the C++ programming language was introduced.
The C++ programming just makes object oriented programming
easier, more reliable and more portable -- that's all that
*any* so called object oriented programming language can do.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #27
cody wrote:
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.
C++ is not slower than C. Many early C++ compilers would translate C++
to C, then proceed as a C compiler.

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.
No, this is just a typing issue. All those things disappear during code
execution. One can use the typedef facility for making abbreviations.

i don't get it why people program in C and faking OOP features(functi on
pointers in structs..) instead of using C++. are they simply masochists or
is there a logical reason?
Many people have to deal with legacy code. Some OOP features have been
coded in C and have been tested. Converting them to C++ means more
development and testing time.

i feel C has to benefit against C++.

--
cody


Each language has its thorns and roses. I just asked if I could use C++
on our next embedded project and the management said no.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #28
"Glen Herrmannsfeldt" <ga*@ugcs.calte ch.edu> wrote in message
news:74******** ************@rw crnsc52.ops.asp .att.net...
Well, some people consider C as a glorified assembler. It isn't quite that, especially as it has changed over the years, but not so far off.


Yes, let's talk about that. When I code in C for my favorite platform I do
tend to "see" the generated assembly in my head. The picture gets bigger and
changes too as I gain more experience, but I do think a lot more like that
machine when programming in C. When I do C++ this is a lot less, I tend to
think in terms of objects and generated objects (templates). Can't decide
what I like better, I keep switching back and forth between the two.

consider this:
size_t i = strcspn(s, "\n");
std::string::si ze_type i = s.find_first_of ("\n");

In my mind strcspn does it a lot simpler than find_first_of.

Or even simpler.
strlen(s);
s.length();

What does s.length() example do? Do strlen somewhere? (some implementations
do). Keep track of the length?
You just give up a lot of control with C++.
Nov 13 '05 #29
On Mon, 06 Oct 2003 14:22:06 -0400, Eric Sosman wrote:

It'll be right next to the place reserved for people who
sling mud anonymously.

If your criticism has merit
Notice that it is a personal opinion, based on my experience. Yours might
differ, and you are welcome to that.
(I know too little of C++ to
evaluate it), have the courage to put your name to it.
What name? How do we know, anyway, that any names at the end of a post
correspond to the poster? Is it going to make you happier if I sign as
James S. Taylor? Or as Madhusudan Patel? Or as Pierre Mattera? Can you
tell if any of those is my real name? What difference does it make?
If the courage is lacking, what are we to make of your confidence in
your own opinion?
Make whatever you want.
And if you have so little confidence in it, why bother us with it?
Wrong conclusion from the wrong premise. You can't conclude anything
from my posting about my relative lack of confidence in any anything.
May the next chimney you slide down have a roaring fire
at the bottom.


Hmm... We touched a raw nerve here :-)

Nov 13 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11194
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL) on the server because of that. Our site will have an SSL certificate next week, so I would like to use AIM instead of SIM, however, I don't know how...
2
5789
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues to execute the code until the browser send his reply to the header instruction. So an exit(); after each redirection won't hurt at all
3
22985
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which field is completed.
0
8455
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. 354 roberto@ausone:Build/php-4.3.2> ldd /opt/php4/bin/php libsablot.so.0 => /usr/local/lib/libsablot.so.0 libstdc++.so.5 => ...
1
8558
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one...
4
18236
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid...
1
6796
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url http://www.mis.gla.ac.uk/biquery/training/ but each of the courses held have maximum of 8 people that could be
2
31368
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
3
23552
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the results of the picture half the size. The PHP I have installed support 1.62 or higher. And all I would like to do is take and image and make it fit a...
0
7888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7811
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8314
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6571
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5689
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.