473,883 Members | 1,600 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 23893
"cody" <do************ *********@gmx.d e> wrote in news:clcm-20031008-0005
@plethora.net:

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


You just confirmed Jack Klein's assesment of your knowledge of C.

--
A. Sinan Unur
as**@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uc*@ftc. gov
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #141
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
microprocessors , 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. (?)

If this benefit is not used, I don't think that there are any big
advantages with C except that it might be easier to learn.

Best regards,
Andreas Lundgren
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #142
On 08 Oct 2003 05:35:19 GMT
"cody" <do************ *********@gmx.d e> wrote:
i though in standard C, there isn't such a thing like "const" you can
only use macros to fake them.

Maybe you should read the standard.
The const keyword is certainly defined, but it has a different meaning
than in C++.
const int foo = 4;
In C, foo is a variable and will be treated as such.
int *pf = (int *)&foo;
*pf = x;
By using casts, you can defeat the const.

In C++, foo would be treated as a true compile-time constant, and would
not actually be placed in memory.
--
Jerry Feldman <gaf-nospam-at-blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053 C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #143
On 08 Oct 2003 05:35:25 GMT
"cody" <do************ *********@gmx.d e> wrote:
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.


there should be no difference between the calls of

class A{ public: static void a(){ } }

and

void a(){}
C has constants. We usually use typedefs rather than struct
and enum tags.


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

Define "plain C". This is possible in standard C, but not in K&R C.
--
Jerry Feldman <gaf-nospam-at-blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053 C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #144
In article <cl************ ****@plethora.n et>, cody
<do************ *********@gmx.d e> writes
> each struct
> and enum have to be prefixed with "struct" and "enum".


Poor baby.


void foo(struct MyStruct struct){}

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


Of course you can, but in C you have to explicitly create a typename
with typedef.

--
Francis Glassborow ACCU
If you are not using up-to-date virus protection you should not be reading
this. Viruses do not just hurt the infected but the whole community.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #145
cody wrote:
[...]
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?


Good grief man, a few posts ago you were talking like you were the King
of Functional Programming, and now this. Please stop the pretence, you
may get away with that with your real-life friends - but not here.

Several people have suggested that you learn a bit about the topics you
write about before stating an opinion. It's hard work (reading books,
doing actual coding, getting to grips with basic concepts and
algorithms, exploring languages and paradigms along the way) and can
take years of dedicated work. It can be worth it though - computer
science is a fascinating subject with many, many faces.

I've been at computers for 18 years now, have an MSc in applied computer
science, and still I don't know half that some of the regulars here know
(and that's a loose upper bound). I'm glad I can actually read their
posts and understand most of it, and can formulate questions precisely
enough to get some very valuable feedback.

Now I am not suggesting you take a hike and rejoin in 2021, but a little
bit of humbleness in the face of people who are, by any standard, much
more qualified than you are to discuss computer language issues wouldn't
hurt.

At least you got your keyboard fixed, that's something :-)

Regards,

Sidney Cadot

Nov 13 '05 #146
In article <cl************ ****@plethora.n et>, <th*@cs.ucr.edu > wrote:
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.
I thought about this a bit, and I have concluded that I disagree.
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.)


It also breaks certain very useful idioms of standard C, such as automatic
(void *) conversions.

Anyway, there is a great deal more to a language than "this compiler will
accept it". Your argument works just as well for Objective C; so far as
I can tell, any valid C program is a valid Objective C program. It works
even better for "C With Classes", even though that's a dead language, than
it does for C++.

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.

Stylistically, I use C instead of C++ because I am better able to express
what I mean in C, and in particular, because I have then some small hope of
being able to read the code later. If you exclude all of the features of
C++ which have tended to produce awful and unreadable code, you might as
well just write in plain old C, and avoid the "enhancemen ts" all together.
If I want an OO bag on the side of C, I prefer Objective C; it makes the
magic features explicit, rather than implicit. If I want an OO language with
C-like syntax, I'll use Java. So far, I've found no tasks for which C++
seemed to be a good fit, except for maintaining existing code that was written
in C++.

-s
--
Copyright 2003, all wrongs reversed. Peter Seebach / se***@plethora. net
http://www.seebs.net/log/ - YA blog. http://www.seebs.net/ - homepage.
C/Unix wizard, pro-commerce radical, spam fighter. Boycott Spamazon!
Consulting, computers, web hosting, and shell access: http://www.plethora.net/
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #147
> > void foo(struct MyStruct struct){}

C isn't as clumsy as you think. The second 'struct' is not only not
necessary, but actually a syntax error.

sorry my mistake. should read void foo(struct MyStruct myStruct){}

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #148
"Sidney Cadot" <si****@jigsaw. nl> schrieb im Newsbeitrag
news:bm******** **@news.tudelft .nl...
cody wrote:
> [...]
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?

The last sentence was not actually meant as a Question.
Good grief man, a few posts ago you were talking like you were the King
of Functional Programming, and now this.
I've never claimed that!
At least you got your keyboard fixed, that's something :-)

:)

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #149
cody wrote:
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?
The last sentence was not actually meant as a Question.
Well, in that case I wonder what it was meant like. I hope you're not
implying it was a rhetorical question, actually meaning "That is what
functional programming is" ... Because you would be sadly mistaken.
Good grief man, a few posts ago you were talking like you were the King
of Functional Programming, and now this.

I've never claimed that!


I never said you claimed that. I said you were talking like that,
posturing. So far you've given no indication whatsoever that you have
any real understanding of either C, C++, or functional programming.
You're just touting a few isolated half-facts and ill-conceived
misguided ideas, I have yet to see anything remotely resembling insight
in any of your posts. Don't you realize from the many similar reactions
that many here are getting fed-up with this attitude?

Now if that is your goal - congratulations . We Have Been Trolled, you
can move on now. If you actually want to improve your knowledge of C, I
sincerely suggest a change of attitude. So what's it gonna be?

Sidney

Nov 13 '05 #150

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

Similar topics

3
11266
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
31461
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
9936
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
11137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10742
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...
1
10845
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9571
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
7970
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
7123
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
5990
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4215
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.