473,889 Members | 1,406 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 23917
On Fri, 07 Nov 2003 10:39:49 -0800, "E. Robert Tisdale"
<E.************ **@jpl.nasa.gov > wrote:
Casper H.S. Dik wrote:
Keith Thompson <ks*@cts.com> writes:
The macros look fine, but the casts are still unnecessary and
potentiall y dangerous. Why not just

#define NEW(type) \
((type *)malloc(sizeof (type)))


The use of macros to "hide" standard constructs is not "fine" by any
definition of "fine" that I can think of.

It makes the code *harder* to understand for other people.


Nonsense!

Using a functor ([inline] function call, C preprocessor macro, etc.)
is *always* preferable to inlining functions manually.


Nonsense!
It's not a function, it's a function *call*.

When I see "malloc" in a program, I know what it means. When I see
"NEW" in a program, I have no idea what it might be until I go find
the definition.

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 13 '05 #471
Harti Brandt wrote:
Definitely. Look at unix v7 sh source for an example...


He's referring to Bourne's use of macros to make the source more
resemble Algol, e.g.
IF whatever THEN blah; FI
Except for being upper-case, it's not really harder to read, and
it makes certain kinds of coding errors less likely (since the
macros always enforce use of compound statements). Having said
that, I agree that there is no pressing need to do this.
Nov 13 '05 #472
In article <3f************ ***********@new s.xs4all.nl>,
Casper H.S. Dik <Ca********@Sun .COM> wrote:
The use of macros to "hide" standard constructs is not "fine" by any
definition of "fine" that I can think of.

It makes the code *harder* to understand for other people.


For other people not familiar with the code, yes.

But if it makes the code more readable for people who are familiar
with it and have to deal with it regularly - and I find some such
macros do - then maybe that outweighs the disadvantage.

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Nov 13 '05 #473
In article <cl************ ****@plethora.n et>, Douglas A. Gwyn
<DA****@null.ne t> writes
cody wrote:
i though in standard C, there isn't such a thing like "const" you can only
use macros to fake them.


Wrong.


Of course he is confused. In C const qualification is a runtime feature
not a compile time one so:

int const c = 10;
int array[c];

is invalid in C, though valid C++. There are excellent reasons for this
difference between C and C++ and is just one example of why C and C++
are different languages that happen to share much syntax and semantics.

It is worth noting that those responsible for the languages are fully
aware of both the differences and the need to remain aligned where it
makes sense to do so. During the last two weeks of October WG14 (C) and
WG21 (C++) both voted to work on providing decimal floating point types.
What makes this ground breaking is that they also agreed that the real
work would be done under a single editor via an obscure (and little used
ISO mechanism) called a rapateur (so obscure that I am not even sure of
the spelling) group which will be jointly and severally created by the
convenors of WG14 & WG21.

It is also worth noting that WG14 wants to work on a TR to incorporate a
library of special maths functions that is part of a WG21 library TR.
WG21 is actively working to ensure that this can be done in an entirely
compatible way.

The often expressed view that somehow C & C++ are competitors has never
actually been true but these recent actions demonstrate a degree of
mutual co-operation that is probably unique among Standards Committees
and comes as a result of another innovation made several years ago which
was to extend the liaison between WG14 and WG21 from the conventional
single person reporting to a group of almost a dozen individuals and
companies who participate in both WGs.

In turn that innovation was the result of an earlier decision that WG14
and WG21 would meet at the same location in successive weeks. This
sometimes greatly stresses the finances and organisational requirements
of those hosting meetings as well as placing extra pressure on attendees
who wish to attend both meetings as it means they are away from normal
work for a fortnight at a time. Ordinary users of either C or C++
should appreciate the degree to which those who do the work on the
relevant standards are going the extra mile (kilometre) to work
together.

--
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 #474
id**@hotmail.co m (Dave Hansen) writes:
Fergus Henderson <fj*@cs.mu.oz.a u> wrote:
CHECK_EXPR_TYPE (foo, int(*)[5]);


So use typedefs.


<shudder>

Typedefing arrays is _evil_.


Not if the typedef name ends in "_array".

--
Fergus Henderson <fj*@cs.mu.oz.a u> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Nov 13 '05 #475
ri*****@cogsci. ed.ac.uk (Richard Tobin) writes:
But if it makes the code more readable for people who are familiar
with it and have to deal with it regularly - and I find some such
macros do - then maybe that outweighs the disadvantage.

But over time such actions make the maintenance cost of your
software higher; not lower; new employees need more time to
come up to speed. Such effects can be considerable.
(Plus their job skills deteriorate; they become less useful for
others because such habits need to be unlearned)

On the subject of this thread: in my experience, C++ code is much
harder to maitain because of "over objectification ". Rather than
a simple "initialize object", people go overboard, define to many
subclasses and before you know it you need to read 10 source files
to understand one line of code.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Nov 13 '05 #476
In article <3f************ ***********@new s.xs4all.nl>,
Casper H.S. Dik <Ca********@Sun .COM> wrote:
But over time such actions make the maintenance cost of your
software higher; not lower; new employees need more time to
come up to speed. Such effects can be considerable.
Quite likely for commercial software products with long lifetimes
written by large companies. Of course, not all programs are like
that.
Rather than
a simple "initialize object", people go overboard, define to many
subclasses and before you know it you need to read 10 source files
to understand one line of code.


That's certainly very true. I have tried to modify a widely-used
piece of free software where everything happens magically as the
side-effect of calls to "new", and it was very frustrating. On the
other hand, maybe the original author only wrote it because he enjoyed
that sort of thing. And the Internet would be a very different place
if he hadn't written it.

-- Richard

--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Nov 13 '05 #477
In article <cl************ ****@plethora.n et>, Thad Smith
<th**@ionsky.co m> writes
Francis Glassborow wrote:
During the last two weeks of October WG14 (C) and WG21 (C++) both
voted to work on providing decimal floating point types.
Where did the impetus for this originate?


IBM I would think something like concurrency support would be more
meaningful to most C and C++ programmers than decimal floating point. I
would think that C++ programmers could handle this with decimal
libraries and overloading without affecting the core language. Why is
the C committee considering this?


You would be very surprised, but for many commercial applications the
cost of emulating decimal floating point arithmetic is very high
(factors of hundreds compared with floating point arithmetic done in a
base directly supported by hardware. Typical billing programs
(constrained by tax legislation to high degrees of precision) can be
improved by overall factors in excess of three if direct hardware
support is provided for decimal floating point.

The exact way that C and C++ might utilise future decimal FPUs is open
for discussion but we are quite certain that if these languages are to
remain competitive (in overall performance) for commercial applications
we need to tackle the issue in a timely fashion.

We are also certain that the two languages should tackle their support
in a way that ensures compatibility of code even though C is likely to
provide new fundamental types and C++ is likely to work with library
types. We do not want the problems (small though they are if code is
written carefully) that surfaced through the independent support of
complex types in C and C++.

In addition it is a matter of choosing a single item to work on though
concurrency is far more demanding and hard to get right.

--
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 #478
Thad Smith wrote:
Francis Glassborow wrote:
During the last two weeks of October WG14 (C) and WG21 (C++) both
voted to work on providing decimal floating point types.

Where did the impetus for this originate? I would think something like
concurrency support would be more meaningful to most C and C++
programmers than decimal floating point. I would think that C++
programmers could handle this with decimal libraries and overloading
without affecting the core language. Why is the C committee considering
this?


Download the PowerPoint presentation.

Essentially, decimal floating point is needed for financial
computation, and software simulation is way too slow. IEEE
754R is specifying a hardware standard that is being widely
implemented. (Many even think that decimal f.p. will soon
displace binary f.p. in silicon.) Exactly how the C
standard will accommodate this is still an open question;
we might simply revise the floating-point model to allow
float, double, and long double to use decimal representation,
or we might provide an additional set of decimal floating
types, or we might take a hybrid approach where both binary
and decimal floating types are introduced and make the
existing floating types an implementation-defined synonym
for one or the other set of new types, which supports a
transitional strategy for those few applications that depend
on having binary, not decimal, floating types.

There is nothing preventing the standards committee from
working on concurrency at the same time (no pun intended),
but so far (at least for WG14) nobody has come forward to
champion a work item toward a concrrency TR.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #479
Thad Smith wrote:

Francis Glassborow wrote:
During the last two weeks of October WG14 (C) and
WG21 (C++) both voted to work on providing decimal floating point types.


Where did the impetus for this originate? I would think something like
concurrency support would be more meaningful to most C and C++
programmers than decimal floating point. I would think that C++
programmers could handle this with decimal libraries and overloading
without affecting the core language. Why is the C committee considering
this?


Here is the paper that is making the proposal.
http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n1016.htm

Decimal floating-point is being added to IEEE-754R
Floating-Point standard (the revision of IEEE-754
now in progress).
---
Fred J. Tydeman Tydeman Consulting
ty*****@tybor.c om Programming, testing, numerics
+1 (775) 287-5904 Vice-chair of J11 (ANSI "C")
Sample C99+FPCE tests: ftp://jump.net/pub/tybor/
Savers sleep well, investors eat well, spenders work forever.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #480

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
10785
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
10887
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
9603
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
5825
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4249
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3253
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.