473,883 Members | 1,663 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 23872
Eric Backus wrote:

(snip)
You also get the best possible approximation to the 'ideal' result if you
use binary floating-point. I'm sure you know this, but it's worth
emphasizing anyway: decimal floating point does *not* get rid of the inexact
nature of floating-point operations for the majority of calculations. It seems to me that the *only* thing decimal floating point gets you is
conformance to the conventions used by the financial community for how to
deal with that inexactness. You can do that today with a library, so the
only thing that hardware support gets you is faster computations for those
calculations where this is a requirement.


(snip)

It gets conformance with the results people get on pocket calculators,
or when they do long division by hand on paper.

People learn early that one third is a repeating decimal, and one tenth
is not. In the old days, when floating point hardware was built with
vacuum tubes, it made sense to preserve every bit. (I think even 30
years ago I couldn't imagine floating point hardware built with vacuum
tubes. It is even harder today.)

In the days of billions of transistors on a chip, only a small
percentage need be allocated to decimal floating point hardware.

-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #601
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu> writes:
Dan Pop wrote:
In <cl************ ****@plethora.n et> "Mike Cowlishaw" <mf*****@attglo bal.net> writes:
(snip)
PL/I did many things wrong (some of its coercions were/are quite
extraordinar y). But given that it was designed in the 1960s it
actually was a significant step forward in many areas. It
certainly wasn't a failure, and it is still widely used today.

It failed to achieve the goal of its designers: to be the ultimate
programming language. It never achieved the popularity of the languages
it was supposed to render obsolete: FORTRAN and COBOL.


There are reasons for that unrelated to the language itself, such as how
long it took to write the compiler, and how slow it ran on machines that
existed at the time.


None of which still applies today. Yet, the usage of PL/I is still
marginal.
It does seem hard to replace an existing language with an improved one.
Not at all. FORTRAN IV had little difficulty replacing FORTRAN II and
F77 had little difficulty replacing F66. C89 replaced K&R C in a couple
of years.
Maybe more relevant here, C++ was an improved version of C, possibly
with the intention of converting C programmers to C++ programmers, yet C
is still reasonably popular.


This is the opposite of what you've been arguing above, i.e. the
difficulty of the improved language to become popular.

Both FORTRAN and COBOL remained popular long after the introduction and
even after the de facto death of the improved PL/I.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #602
Hans-Bernhard Broeker wrote:
....
Wrong citation, I think. Those fact were the rationale for having
FLT_RADIX != 2 in _C90_. C99 didn't change that. ...
I'll take your word for that. I've never had a copy of C90 standard; it
was too expensive when it was useful to me, and ceased being useful to
me by the time the price dropped. So I'm not well-informed about which
features were introduced in C90 vs C99.
a much heavier weight on FLT_RADIX==2 architectures by devoting a lot
of appendix and standardized optional parts of the library to IEEE 754
support.
Part of that support included ways of checking to see whether a given
implemenatation supports IEEE 754.
I.e., if anything, C99 moved *away* from FLT_RADIX != 2, not towards
it. And that's why I'm concerned about it. People looked at the


Adding a feature that makes it possible to check for IEEE 754 support
counts, in my book, as making it clearer that IEEE 754 need not be
supported. Also, there are a few citations in the standard that refer to
IEEE 854, which defines a radix-independent standard for arithmetic of
which IEEE 754 is essentially a special case, for radix=2. I have a copy
of IEEE 854, but not of IEEE 754, so I'm not sure exactly how they
differ.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #603
glen herrmannsfeldt wrote:
Maybe more relevant here, C++ was an improved version of C, possibly
with the intention of converting C programmers to C++ programmers, yet C
is still reasonably popular.


Actually "C with classes", which evolved into C++, wasn't
an attempt to convert anyone. It was a way of getting
object-oriented features on the Unix platform by
exploiting an existing code generation system.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #604
On 05 Dec 2003 07:23:42 GMT, glen herrmannsfeldt <ga*@ugcs.calte ch.edu>
wrote:
Maybe more relevant here, C++ was an improved version of C


I sure what you meant to say is "C++ was *intended to be* an improved
version of C".
--
#include <standard.discl aimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #605
"Mike Cowlishaw" <mf*****@attglo bal.net> wrote in message
news:cl******** ********@pletho ra.net...
Eric Backus wrote:
You also get the best possible approximation to the 'ideal' result if
you use binary floating-point. I'm sure you know this, but it's worth
emphasizing anyway: decimal floating point does *not* get rid of the
inexact nature of floating-point operations for the majority of
calculations.


Indeed, but there is the huge class of 'interesting' calculations
where using base 10 FP will yield exact results where binary
cannot.


My intuition, bad though it may be, says that it is not so huge. Certainly
you can add and subtract many decimal values exactly, though you can also do
this with scaled integers. You can multiply decimal values exactly, at
least until you exhaust the precision of the decimal floating-point format.
As soon as you divide by other decimal values or even by an integer, or take
powers or roots, the results become inexact. So you can add up an itemized
bill exactly, and compute sales tax exactly. But the average daily balance
of a credit card, compounded interest, loan payments, or investment ROIs are
all going to be inexact.

It seems to me that the *only* thing decimal floating point gets you
is conformance to the conventions used by the financial community for
how to deal with that inexactness.

If, by 'financial community' you include everyone who does
calculations on their finances, I agree.


Point taken, though I'm not even sure that all such rounding conventions are
consistent with each other. Do all loan payment calculations use the same
number of guard digits? Do all mutual funds round numbers of shares to the
same number of digits? Does everyone use round-to-nearest, or do some use
round-towards-zero? Can an expression be evaluated to higher precision than
the input variables, and then later rounded back to the input precision, or
must every partial result be rounded to the input precision? Are all
operations and library functions required to be accurate to 1/2 lsb, or is
an error of 1 lsb allowed? And given the inexact nature of floating-point,
answers still vary depending on whether you use "decimal float" vs. "decimal
double", right?

Issues like this make me wonder just how much is really gained by using
decimal floating point.

You can do that today with a
library, so the only thing that hardware support gets you is faster
computations for those calculations where this is a requirement.


It's certainly true that the only thing that hardware support
gives you, over a library of assembler code, is improved
performance. But we are talking orders of magnitude
(remember how slow binary FP emulation was?).


Yes I do. I guess my feeling is that floating-point, in general, is
essential to a wide range of applications, while explicitly decimal
floating-point is essential to a much more limited range of applications. I
have to admit that I'm biased here, because I use floating-point all the
time but I personally don't have an immediate use for decimal
floating-point.

Note that this library could be implemented in assembly on those
platforms that have hardware support, so you don't really even need
native C support for decimal floating point in order to get the
faster computations. Of course, using such a library is inconvenient
compared to having native C support, but that inconvenience is payed
only by those who need this capability. Is that group of people
large enough that inconveniencing them justifies changing the
language?


Of course; C is the 'assembly language' on which the vast
majority of other languages are based and in which they are
implemented. It is the very foundation of software; without
access to the hardware primitive types in C, every other
language has to provide it from scratch, in a platform-
dependent way.


If there were a standard C library interface to decimal floating-point opera
tions, every other language could use that interface to implement things.
It's only the actual implementation of that C library that would need to be
platform dependent. Remember there has to be platform dependency somewhere,
my argument is that it can go in this standard library rather than in the
compiler.

I still think it comes down to a question of convenience. A standard C
library interface would certainly work, but is not as convenient for those
that need it. Built-in decimal floating-point is convenient for those that
need it, but unnecessary complication for those that don't, and is extra
effort for compiler writers.

--
Eric Backus
R&D Design Engineer
Agilent Technologies, Inc.
425-356-6010 Tel
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #606
Mike Cowlishaw wrote:
Eric Backus wrote:
"Mike Cowlishaw" <mf*****@attglo bal.net> wrote in message
news:cl****** **********@plet hora.net...
Dan Pop wrote:

And what is the exact result of dividing 1 penny by 3, when using
decimal floating point arithmetic?

This is exactly why floating-point is the right solution. Whenever
the result is Inexact, you get the best possible approximation to
the 'ideal' result -- that is, full precision.


You also get the best possible approximation to the 'ideal' result if
you use binary floating-point. I'm sure you know this, but it's worth
emphasizing anyway: decimal floating point does *not* get rid of the
inexact nature of floating-point operations for the majority of
calculation s.


Indeed, but there is the huge class of 'interesting' calculations
where using base 10 FP will yield exact results where binary
cannot.


The only time that you get an exact with decimal and not with binary is
when you are dividing by a power or 5, optionally combined with a power
of 2.

If you have a daily rate and divide by 8 hours to get an hourly rate --
no benefit. If you have a weekly water usage and divide by 7 to get a
daily average -- no benefit. If you evaluate a transcendental, like
sine or take a square root -- no benefit.

When you have an approximation from any of these calculations, then
round to a given precision for presentation, you usually get the same
results or closer for binary, given the same number of bits for
calculation. If you use an IEEE-754 64-bit binary floating point, you
get in excess of 15 digits of precision. Which applications find that
insufficient and why?

Thad
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #607
"Eric Backus" <er*********@al um.mit.edu> wrote:
"Mike Cowlishaw" <mf*****@attglo bal.net> wrote in message
news:cl******* *********@pleth ora.net...
Dan Pop wrote:
> And what is the exact result of dividing 1 penny by 3, when using
> decimal floating point arithmetic? Or is division a prohibited
> operation for this class of applications?
This is exactly why floating-point is the right solution. Whenever
the result is Inexact, you get the best possible approximation to
the 'ideal' result -- that is, full precision. With a fixed scaling
factor you cannot make full use of the precision unless you
know how many digits there will be to the left of the radix
point.


You also get the best possible approximation to the 'ideal' result if you
use binary floating-point. I'm sure you know this, but it's worth
emphasizing anyway: decimal floating point does *not* get rid of the inexact
nature of floating-point operations for the majority of calculations.


I have not seen that anyone is saying that it does. It does give
less astonishing results though (as in Law of Least Astonishment).
It seems to me that the *only* thing decimal floating point gets you is
conformance to the conventions used by the financial community for how to
deal with that inexactness. You can do that today with a library, so the
only thing that hardware support gets you is faster computations for those
calculations where this is a requirement.
The same would be true of binary floating point. Some have
raised the point that decimal floating point would raise the bar for
some embedded applications. Let us remove all floating point from the
language and handle it with libraries. If that does not seem too
appetising to you, consider how the people who want decimal float
feel.

I have long felt that the lack of decimal floating point is a
severe lack in many languages.
Note that this library could be implemented in assembly on those platforms
that have hardware support, so you don't really even need native C support
for decimal floating point in order to get the faster computations. Of ^^^^^^^
Replace with "any".
course, using such a library is inconvenient compared to having native C
support, but that inconvenience is payed only by those who need this
capability. Is that group of people large enough that inconveniencing them
That is quite right. Many of the programs that I write do not
use floating point at all. Let us get rid of the baggage of floating
point. I mean, I could consider others, but a little inconvenience
will, ah, strengthen them.
justifies changing the language?


You will never know for sure until it is available. If I need
decimal floating point in an app and C does not have it, C is out of
the running. I will not make elaborate complaints; I will simply not
consider an language that is inadequate to my requirements.

I understand that some people think that C should be inadequate
in this regard. It might be different if their ox were being gored.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #608
cody wrote:
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?


when you have a C++ Library you can only call C-Style-Functions from that
Library. You cannot export Classes/Methods from that Library.


He said "call", not "export", and there's a lot more to the C++ Library
than Classes and Methods. For instance, to take a ridiculous (but AFAIK,
legal) case, memcpy() could be implemented as a wrapper for
std::copy<unsig ned char>().
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #609
On 05 Dec 2003 07:23:42 GMT in comp.lang.c.mod erated, glen
herrmannsfeldt <ga*@ugcs.calte ch.edu> wrote:
Dan Pop wrote:
In <cl************ ****@plethora.n et> "Mike Cowlishaw" <mf*****@attglo bal.net> writes:


(snip)
PL/I did many things wrong (some of its coercions were/are quite
extraordinar y). But given that it was designed in the 1960s it
actually was a significant step forward in many areas. It
certainly wasn't a failure, and it is still widely used today.

It failed to achieve the goal of its designers: to be the ultimate
programming language. It never achieved the popularity of the languages
it was supposed to render obsolete: FORTRAN and COBOL.


There are reasons for that unrelated to the language itself, such as how
long it took to write the compiler, and how slow it ran on machines that
existed at the time.

It does seem hard to replace an existing language with an improved one.

Not long ago a discussion in another newsgroup related to assembler
programming reminded me of ALP, which is a preprocessor for a certain
assembler that offers free format, structured programming, and some
other features, but it never got popular.

Ratfor, and a few different versions of MORTRAN as Fortran
preprocessor s, again with improvements over the original, but never got
very popular.

The original PL/I compiler supplied conversion programs to convert
Fortran, COBOL, and maybe ALGOL to PL/I.

Maybe more relevant here, C++ was an improved version of C, possibly
with the intention of converting C programmers to C++ programmers, yet C
is still reasonably popular.


I think you're just demonstrating programmer inertia -- programmers
want to be able to write the same old code, and *possibly* learn the
best ways to use the new features. IME a lot of "C" programmers were
never very happy using pointers, except to modify function arguments,
preferring Pascal style array indices over C pointers, and Pascal
style I/O processing over C loops with function calls. I suspect a lot
of C/Pascal style code is being written in C++ and Java.
--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada

Br**********@CS i.com (Brian dot Inglis at SystematicSw dot ab dot ca)
fake address use address above to reply
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #610

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
9935
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
9791
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
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
10844
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...
2
4215
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3231
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.