473,883 Members | 1,544 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
Dan Pop wrote:
In <cl************ ****@plethora.n et> glen herrmannsfeldt writes:
It gets conformance with the results people get on pocket
calculators , or when they do long division by hand on paper. Why is such conformance (up to the last digit) important? People learn early that one third is a repeating decimal,
and one tenth is not. People programming computers learn early that this property is neither
true nor relevant when performing floating point computations. Regardless
of the base, floating point numbers are approximations of a subset of the
real numbers (the [-type_MAX, type_MAX] interval).
How about a requirement that only people who have passed a high school
calculus class are allowed to use floating point arithmetic? Then issue
licenses to people who have proved that they understand the effects of
rounding and truncation in floating point arithmetic. Only holders of
such a license can purchase and use programs that use floating point.

I believe that processors should now have float decimal, though I don't
know that I would ever use it. It would almost be worthwhile not to
have to read newsgroup posts from people who don't understand binary
floating point.
In the days of billions of transistors on a chip, only a small
percentage need be allocated to decimal floating point hardware.

A small percentage that would be better used as an additional binary
floating point execution unit.


With SMT, processors are going the other way. One floating point unit
used by two processors. The additional logic to generate a decimal ALU
relative to a binary ALU is pretty small. As I understand the
proposals, they store numbers in memory with each three digits stored
into 10 bits, though in registers they are BCD. The memory format is
only slightly less efficient than binary, partly made up since fewer
exponent bits are required for the desired exponent range.

I will guess that it increases the logic between 10.000% and 20.000%.

An additional binary floating point unit requires the logic to schedule
operations between the two, and eliminate conflicts between them.

-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #621
CBFalconer wrote:

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.


AFAICT only a binary system has the advantage of 'assumed leading
bit one', allowing replacement by a sign bit. This means a binary
system can always provide better accuracy than any other built on
the same word size.

The 'assumed leading bit one' of the mantissa is the low order of the
exponent. The sign bit is the high order bit of the float or double. But
you're right. The assumption gives you an extra virtual bit of
precision. My 32-bit float has 24 bits of mantissa, 8 bits of exponent
and a sign bit. Count 'em. My 64-bit double has 53, 11 and 1. Like a
Baker's dozen (13 instead of 12). :=)
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #622
glen herrmannsfeldt <ga*@ugcs.calte ch.edu> wrote:

[snip]
How about a requirement that only people who have passed a high school
calculus class are allowed to use floating point arithmetic? Then issue
licenses to people who have proved that they understand the effects of
rounding and truncation in floating point arithmetic. Only holders of
such a license can purchase and use programs that use floating point.

I believe that processors should now have float decimal, though I don't
know that I would ever use it. It would almost be worthwhile not to
have to read newsgroup posts from people who don't understand binary
floating point.


While we are at it, let us do the same for integer arithmetic.
That way, we need never again see "I think my compiler has a bug. My
program keeps giving wrong answers. It says that 5/3 equals 1."

[snip]

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 14 '05 #623
Dan Pop wrote:
If PL/I had any compelling merits, I'm sure it would have caught on,
sooner or later. It was certainly not lack of availability of
implementations that caused its failure.
PL/I was moderately successful; for example MULTICS was
implemented in PL/I, and a lot of IBM systems programming
was done in PL/I. Just because other languages, designed
using "lessons learned" from previous languages including
PL/I, caught on doesn't make PL/I a failure, any more
than FORTRAN, COBOL, BASIC, LISP, etc. were failures.
Some of them evolved and are still widely used, others
fell into disuse; however, they had a significant impact
for their time and were used to implement many valuable
applications. That's not "failure".
What people call F77 today is Fortran-77 with a ton of extensions, mostly
inherited from VAX Fortran. I can't remember ever seeing a (non-trivial)
program written in pure ANSI F77.


I have seen literally hundreds, many of them written by
scientists and engineers on PDP-11 Unix systems, where
the native Fortran was Fortran-77 with essentially no
extensions. (There was also a port of DEC's F4P that
some used because of faster execution.)
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #624
glen herrmannsfeldt wrote:
..... snip ...
With SMT, processors are going the other way. One floating point
unit used by two processors. The additional logic to generate a
decimal ALU relative to a binary ALU is pretty small. As I
understand the proposals, they store numbers in memory with each
three digits stored into 10 bits, though in registers they are
BCD. The memory format is only slightly less efficient than
binary, partly made up since fewer exponent bits are required for
the desired exponent range.


Think about how you would normalize such a value. That would not
be a decimal format, that would be a base 1000 format. The count
of significant digits would jitter over a range of 3!

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #625
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu> writes:
Dan Pop wrote:
In <cl************ ****@plethora.n et> glen herrmannsfeldt writes:
It gets conformance with the results people get on pocket
calculators , or when they do long division by hand on paper.
Why is such conformance (up to the last digit) important?

People learn early that one third is a repeating decimal,
and one tenth is not.
People programming computers learn early that this property is neither
true nor relevant when performing floating point computations. Regardless
of the base, floating point numbers are approximations of a subset of the
real numbers (the [-type_MAX, type_MAX] interval).


How about a requirement that only people who have passed a high school
calculus class are allowed to use floating point arithmetic?


No need for that, in order to understand floating point arithmetic.
The basic concepts are within the grasp of a junior high school student.
Then issue
licenses to people who have proved that they understand the effects of
rounding and truncation in floating point arithmetic. Only holders of
such a license can purchase and use programs that use floating point.
The user doesn't need any clue, only the programmer. If the programmer
does his job well, the user will get the expected result.

What we see in practice is clueless *programmers* that don't get the
results they expect from their programs. And changing one aspect of
floating point won't make it work as expected by the clueless ones, e.g.
largeval + 1 == largeval will still evaluate to true, baffling the
ignorant. No, decimal floating point is not the right cure for
ignorance.
I believe that processors should now have float decimal, though I don't
know that I would ever use it. It would almost be worthwhile not to
have to read newsgroup posts from people who don't understand binary
floating point.
Do you *really* think anyone in the industry would care about this
argument? Do you really think it is worth the loss of precision (for the
same bit count).
In the days of billions of transistors on a chip, only a small
percentage need be allocated to decimal floating point hardware.

A small percentage that would be better used as an additional binary
floating point execution unit.


With SMT, processors are going the other way. One floating point unit
used by two processors.


Intel's flagship processor in terms of high performance computing has
multiple FP execution units.
The additional logic to generate a decimal ALU
relative to a binary ALU is pretty small. As I understand the
proposals, they store numbers in memory with each three digits stored
into 10 bits, though in registers they are BCD. The memory format is
only slightly less efficient than binary, partly made up since fewer
exponent bits are required for the desired exponent range.

I will guess that it increases the logic between 10.000% and 20.000%.
For *what* redeeming benefits?
An additional binary floating point unit requires the logic to schedule
operations between the two, and eliminate conflicts between them.


Which is paid off by increasing the FP throughput by a factor of 2.
Which explains why most modern architectures have chosen to go this way.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #626
> This has already been rehashed to death. Use an appropriate scaling
factor and all these computations can be performed exactly using
binary floating point, or, even better, long long arithmetic. Before
C99, the
usual portable solution was double precision, but 64-bit integer
arithmetic is even more appropriate to this kind of applications.
Maybe
even more appropriate than decimal floating point arithmetic
(depending
on the size of the mantissa and the scaling factor imposed by the
application).


This is, indeed, how decimal arithmetic has been done in the
past. It is no longer an adequate or acceptable approach.

It's a valid approach for binary FP, too, and 'manual'
scaling of binary calculations is perfectly feasible.
But it is difficult, tedious, and error-prone.

In addition to these problems, the 'scaled binary'
approach for decimal means that one is constantly
carrying out base conversions. With decimal FP
as the foundation, no base conversions occur.

Mike Cowlishaw
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #627
> With SMT, processors are going the other way. One floating point unit
used by two processors. The additional logic to generate a decimal
ALU relative to a binary ALU is pretty small. As I understand the
proposals, they store numbers in memory with each three digits stored
into 10 bits, though in registers they are BCD.
Pretty close ... registers would normally hold the numbers in the
compressed format (so they stay 64-bit, etc., and can
be shared with the BFP unit). These can then be expanded to
BCD within the DFP unit to carry out arithmetic -- this only
costs 2-3 gate delays. [Other approaches are possible.]
I will guess that it increases the logic between 10.000% and 20.000%.


Sounds about right.

Mike Cowlishaw
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #628
On 11 Dec 2003 05:07:54 GMT in comp.lang.c.mod erated, Da*****@cern.ch
(Dan Pop) wrote:
In <cl************ ****@plethora.n et> James Kuyper <ku****@saicmod is.com> writes:
Thad Smith wrote:

Mike Cowlishaw wrote:

...
> 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.


What about multiplication by integers, addition, and subtraction? Those
are very common operations, especially in the financial world, and
they're all exact (except when they overflow) when performed in decimal
arithmetic, and inexact when performed in binary floating point. I'm
assuming here that the floating point numbers being multiplied, added,
and subtracted are numbers that binary float can't represent exactly,
but which decimal floating point can, such as 1.10. Such numbers are the
rule, not the exception, in financial calculations.


This has already been rehashed to death. Use an appropriate scaling
factor and all these computations can be performed exactly using binary
floating point, or, even better, long long arithmetic. Before C99, the
usual portable solution was double precision, but 64-bit integer
arithmetic is even more appropriate to this kind of applications. Maybe
even more appropriate than decimal floating point arithmetic (depending
on the size of the mantissa and the scaling factor imposed by the
application) .


I'm not at all sure that the financial community would be interested
in decimal floating point rather than fixed point arithmetic.
Unless extended precision is available, you can handle less than a
billion to six decimals.
I've done back of envelope calculations to ensure that numbers that
had to add up exactly would not lose precision in intermediate values
used within companies.
A safer range for most transactional work would be billions to six
decimals, requiring sixteen digits, and another three digits for
safety if you're a multinational company or federal government.
If you're converting between currencies with six decimals accuracy,
then you need to add another six decimals onto the end for exactness.
The total range tends not to change by currency; lire, won, yen, yuan
are like cents or pennies in other currencies: the decimal place comes
after them instead of before them; and if you're dealing in larger
aggregates, you often don't need the precision to more than one or a
thousand currency units.
Don't know much about countries' internal economies: would be
interesting to know how big the numbers are required to be for India
and China, whose populations are three to four times bigger than the
EU, Indonesia, US?
--
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 #629
In article <cl************ ****@plethora.n et>, Dan Pop <Da*****@cern.c h>
writes
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu>
writes:
In the days of billions of transistors on a chip, only a small
percentage need be allocated to decimal floating point hardware.


A small percentage that would be better used as an additional binary
floating point execution unit.


I think in real terms, weather we like it or not this is pointless
argument.

IBM will produce the CPU with decimal FP
Compiler vendors will produce compiler to support IBM's FP
Other Silicon vendors are likely to put Decimal FP on some of their CPU
Other compiler vendors will support them.

I suggest that we stop the arguing about if it is a good idea as it is
going to happen anyway. What we have to do is make sure that the API is
sensible and in the C and C++ standards so that the compiler vendors all
do (at least the core) support for FP10 the same way.

I would suggest that this is one place where it would be sensible to
have, at least the core, the same for C and C++
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #630

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
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...
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
10412
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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
5797
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...
1
4609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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.