473,889 Members | 1,387 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 23915

"Jirka Klaue" <jk****@ee.tu-berlin.de> wrote in message
news:bm******** **@mamenchi.zrz .TU-Berlin.DE...
Mike Wahler wrote:
...
Most people I know tell me I have
an extraordinary sense of humor.
This proves nothing.


It was not an attempt to prove anything.
BTW, it could stand for "none at all" as well.


Or anything else you like. I treat it as what it was,
an exchange of opinions between Cody and myself about
"sense of humor."

-Mike
Nov 13 '05 #151
thp
In comp.std.c Douglas A. Gwyn <DA****@null.ne t> wrote:
+ th*@cs.ucr.edu wrote:
+> 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.)
+
+ On essentially any platform there is a unique standard API
+ for C linkage. And it is easy to get that linkage from C++
+ by using "extern C". Therefore, libraries written in C are
+ readily used from both C and C++ applications. Libraries
+ that rely on C++-specific features (e.g. classes) are not
+ readily used from C applications.

Is it feasible to interpose a proxy library whose headers are
conforming C code that's compiled with a C++ compiler and that calls
functions from the C++ library?

Tom Payne
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #152
thp
In comp.std.c Chris Hills <ch***@phaedsys .org> wrote:
+ In article <cl************ ****@plethora.n et>, th*@cs.ucr.edu writes
+>In comp.std.c cody <NO************ ****@gmx.net> wrote:
+>
+>C is pretty much, but not quite, a sublanguage of C++.
+
+ C++ is based on C90 However C++ is no longer a super set of C. They are
+ different languages.
+
+>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.
+
+ This is not true.

We are speaking of "C programmers to don't use the non-C++ features of
C", i.e., they use only those features of C that are C++ compatible.

+ The are using C.

That's why I referred to them as "C programmers".

+ C++ Inherits from C NOT the other way round.

I'm told that C has actually imported a few C++ features, but that's
beside the point.

Tom Payne
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #153
> > > > 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.
?


A colloquialism roughly equivalent to "why don't you try it and find
out, instead of whining to me about it?"


I said that some people said that C would be faster and I don't believe
that.
So why should i test it? I don't blieve it, as i said. But for the case that
people
where right, i asked that if somebody would know a case where C is faster
than C++, should tell me.
i though in standard C, there isn't such a thing like "const" you can only use macros to fake them.


Well, you're wrong. Your response here, and your response to ERT,
demonstrate that you apparently have a large gap in your C knowledge
spanning roughly the years 1988-1998. (While "ancient" K&R C didn't
have 'const', it has been standard C since 1989, and C99 didn't
change much in this respect.)


Well, i'read books about C++ but this is long ago, and as we all know, books
are not
very up-to-date anyway and the knowlegde of some authors is alarming. how
many C++ books keep you telling to include <iostream.h> instead of
<iostream> or void main() instead of int main()?
void foo(struct MyStruct struct){}

in C you cannot omit the keyword "struct". when it compiles without "struct" you probably using a C++ compiler.


False. The above is neither C *nor* C++; it's a syntax error in
both languages.


sorry, my mistake. it should read

void foo(struct MyStruct myStruct){}

or something similar :)
(And you should read up on 'typedef'; it's the C
Gods' answer to the keyword-impaired.)
you mean a typedef let you omit the keyword? thanks, i didn't know that.
not faster than C++. why should it?


"Suck it and see," remember? I could run some size and speed
benchmarks on my C and C++ compilers, and let you know the
quantitative differences, but why should I bother? You're the
one who wants to know! You do it!


as i said, why should it? i asked just in case somebody could tell me a case
where
this assumption could be true, but i think it is an illogigal assumption.
(Oh, and re your response to Jack Klein: While IMHO Jack was a
bit harsh, and a bit defensive, his criticism of your style was
dead on.
sorry i don't know the term "dead on". what does it mean?
You really *don't* seem to know very much about C,
you're right. before i asked my question here, i wasn't aware that there are
so many
differences between C and C++. i always though of C as simply a subset of
C++
which is, as i learned here, not true.
and haven't demonstrated a terrible amount of knowledge of C++
i don't consider myself as a expert in C++ but i think i have reasonable
knowlegde of
it. the last year i programmed only Java and C# so my C++ knowledge might be
a bit
rusty.
either (not that that would be on-topic here), yet you want us
to prove to you somehow that C is "still relevant," or something.


this already was proven to me by other posters.

--
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 #154
thp
In comp.std.c Seebs <se***@plethora .net> wrote:
[...]
+ In reality, to say you are "programmin g in C++" means not just that your
+ code happens to be syntactically C++, but that you have adopted the philosophy
+ and design of that language. Often, people whose code passes through a C++
+ compiler are really writing FORTRAN IV; I've seen such code.

Hence, the distinction between idiomatic and non-idiomatic C++.

Tom Payne
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #155
"Andy Sinclair" <an**@r2g2.nosp amplease.co.uk> schrieb im Newsbeitrag
news:cl******** ********@pletho ra.net...
cody wrote:
void foo(struct MyStruct struct){}

in C you cannot omit the keyword "struct". when it compiles without "struct"you probably using a C++ compiler.

typedef struct
{
int a;
int b;
} foo;

void bar(foo data)
{
}

Thank you! I always said it, a snippet of code can tell more than hundreds
words!

--
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 #156
In article <cl************ ****@plethora.n et>, Douglas A. Gwyn
<DA****@null.ne t> writes
C supports the const keyword now.

cody wrote:
since when? C99?


No, since the first C standard in 1989.


That was just a local standard :-)
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #157
In article <cl************ ****@plethora.n et>, Andreas
<d9****@efd.lth .se> writes
C is much more alike the final machine code, and that is a benefit
that some programmers take advantage of. This is handy when coding
microprocessor s, which are mostly done in C, since assembler quickly
gets out of hand. Also when core are to be translated in to HDL
language to be realized in hardware, most often C (and SystemC) is
used.

A wild guess is that every minute of the day, there is more micro
processor code running than PC code running. (?)


According to figures I have seen from several silicon vendors (they vary
slightly but they average out at about 1 in 3 processors on (and above)
the planet is an 8051....

PC x86 processors make up less than 10% of the total the other 88% are
embedded systems... (the 2% are MACs and mainframes.)

I am sure the figures have changed in detail but it gives a fair
picture.


/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #158
"cody" <do************ *********@gmx.d e> wrote in message
news:bm******** ****@ID-176797.news.uni-berlin.de...
> > i disagree on that.
> >how can you make sure that all data is properly
> > encapsulated if
> > the language provides no support?
It does provide it. What do you mean by "properly"?

struct data
{
int details;
};

The value 'details' is properly encapsulated inside
the struct type 'data'. This encapsulation could
indeed be corrupted via making coding errors, but
this does *not* mean the encapsulation is 'improper'.


This is no encapsulation. encapsulation means that nobody (except the

class itself)
can access the variable directly,
or the direct acess is limited to certain
classes for example derived classes or friend classes.
Go ahead and believe that if you like. I'm done trying
to correct your misconceptions.

You also still seem to be insisting that OO concepts must
be expressed with C++ constructs, which is certainly
untrue. However my example is still valid in that language
anyway. It's not the way I'd actually do it with C++, but
that doesn't mean it's not encapsulation.
You are talking about things you don't understand.
If it pleases you to believe that, I don't mind.
However your opinion of my level of knowlege matters
to me not at all, given the statements you've made
in this forum.
But the same is true for
me when i talk about plain C :)
So you admit that when talking about C, you are talking
about something you don't understand. So why do you
make the claims about it that you have?
The existence of the possibility of coding errors does
not preclude a program from being expressed with OOP.
A language's enforcements of OOP concepts is a very
useful tool, but need not be present for a program
to be expressed using OOP.


This is the point of encapsulation. it simply cannot happen that you

access a variable that you have no access to,
Feel free to believe that if you like. A couple of suggestions:

1. Research the terms 'data hiding' and 'interface'.

2. Call upon your knowledge of English in considering
why certain OO concepts have the names they do.
due to coding mistakes (Except you unintentional manipulate the variable
using a memory address if you know its offset in the struct/class)
No. 'for_each()' is simply a function which iterates
through a sequence, and applies a function to each
member of that sequence. It's a generalization of
a simple 'for loop', designed to be useful with
the standard library 'container' abstraction.
Nothing at all to do with 'functional programming'.


Functional programming means you don't say how you want it done like in
[C/C++/Pascal or similar] but you just say what you want have done.

for (int i=0; i<10; i++) a[i]+=2; /* you excatly say how to do it */

for_each (myContainer, MultiplicateWit h(2)) /* you just say what is to do
you don't care about how it should be done */


1. That does *not* express an invocation of the C++
library function 'for_each()'

2. A correct invocation of 'for_each' expresses exactly
the same concept as your 'for' example above, only
using different words.

3. 'for_each' behavior is not an example of functional programming.
That's the way functional languages like haskell or lisp or whatever solves problems.


I don't think so.
I'm going to stop trying to correct your misconceptions now.
If you'd like personal tutoring in C and/or C++, I'll need
some compensation.

-Mike
Nov 13 '05 #159
"cody" <do************ *********@gmx.d e> wrote in message
news:bm******** ****@ID-176797.news.uni-berlin.de...
Mike said that:
struct data
{
int details;
};
is properly encapsulated data. It isn't.

Maybe he meant that if one would use this struct as opaque datatype, yes
that would indeed be good encapsulation.
If he actually meant that, he was right. I wasn't aware that OOP is so

well understood by C-programmers.
Apparently you're also unaware that the fact that many if not
most people who know and use C also use other development
tools and techniques as well.
This always was a contradiction for me.
"C programmer" is always a meaningless term for me. I am a
programmer. I use three or four different languages on a
regular basis. Sometimes I use others as well for specialized
tasks. I use whichever programming 'paradigm'(s), tools etc.
that I find most suitable for a given task. I don't know *any*
practicing professionals who only use a single language and/or
programming 'style' or toolset.
> No. 'for_each()' is simply a function which iterates
> through a sequence, and applies a function to each
> member of that sequence. It's a generalization of
> a simple 'for loop', designed to be useful with
> the standard library 'container' abstraction.
> Nothing at all to do with 'functional programming'.

Functional programming means you don't say how you want it done like in
[C/C++/Pascal or similar] but you just say what you want have done.


Indeed. What has this to do with your point?


for_each() says: Iterate throw all items in this container and you don't
have to say how it should do that.
Isn't that what functional programming is?


Feel free to believe that if you like.

-Mike
Nov 13 '05 #160

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

Similar topics

3
11267
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 to send data via POST over https and recieve data from the Authorize.net server over an https...
2
5865
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
23053
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
8508
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 => /usr/local/lib/libstdc++.so.5 libm.so.1 => /usr/lib/libm.so.1
1
8621
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 column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have...
4
18317
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 that? I tried registering all POST and GET vars as SESSION vars but
1
6890
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
31469
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
23617
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 3x3. Any suggestions to where I should read or look would be appreciated.
0
9961
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9805
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10784
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9602
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7991
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7148
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6021
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.