473,883 Members | 1,665 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
On 22 Nov 2003 02:16:49 GMT
"Eric Backus" <er*********@al um.mit.edu> wrote:
And I might agree with those reactionary types--note that I didn't
claim C++ was an improvement, just that C would probably not be used
for a financial program.
In point of fact even decimal FP will not avoid some of the
problems.


I'm sure that's true.

While I generally agree. I do think that C++ is more suited to financial
programming, I am aware of many financial systems written in C. Rather
than changing the C language standard floating point, I would prefer a
built-in fixed point type, somewhat similar to the PL/1 fixed type.

--
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 #541
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu.c om> writes
Questions:

[1] Assuming the standard were changed to include FP-10, will the
compiler producers consider the new standard non-relevant, given
that it covers hardware not now available anywhere in the world?
I would lay fairly high odds that by the time a TR is completed on this
subject that there will be hardware with direct support for FP-10.

[2] Assuming availability of conforming compilers, what is the
wisdom of incorporating changes that cannot be used in any
production CPU/FPU on the planet? Are we ready to declare all
current production CPUs obsolete?
No, because it will be possible to support the new FP-10 types in
software (just at a serious performance cost)

[3] What will be the cost of adding a second (if FP-10 doesn't
simply replace FP-2) floating-point processor to all CPUs? I
strongly suspect that most CPUs don't have that much "spare" real
estate; so this will almost certainly mean substantial redesign
of all current CPUs (incorporate additional addressing, bussing,
interrupts, clocking,..,lay out,power consumption [my head hurts])
Looking at the latest CPUs with multiple pipelines etc. I suspect that
this is an entirely non-issue.

[4] Would the application needs be met by a simpler, more direct
approach? If rounding is a problem, for example, could not logic
be added to current (FP-2,FP-16) FPUs to produce the desired
behaviors?


Much current financial software completely avoids use of the FPU and
does everything via integer arithmetic and fixed point arithmetic. I
think this point is being largely missed. In a way the proposal to
provide FP-10 FPUs is not very different from the inclusion of FPUs in
CPUs to replace the software emulation of FPUs normal throughout most of
the 1980's. I can remember the time when I would elect some form of
fixed point arithmetic in order to avoid the heavy computational costs
of binary floating point. Largely engineering and scientific computing
no longer has to go that route (Remember how dramatic Fractint was in
its performance because it use hand-coded fixed point arithmetic where
possible?) It is now the financial software that largely avoids direct
use of the hardware because it fails to meet their needs.
--
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 #542
Jerry Feldman <ga********@blu .org> wrote:
On 22 Nov 2003 02:16:49 GMT
"Eric Backus" <er*********@al um.mit.edu> wrote:
And I might agree with those reactionary types--note that I didn't
claim C++ was an improvement, just that C would probably not be used
for a financial program.
> In point of fact even decimal FP will not avoid some of the
> problems.


I'm sure that's true.

While I generally agree. I do think that C++ is more suited to financial
programming, I am aware of many financial systems written in C. Rather
than changing the C language standard floating point, I would prefer a
built-in fixed point type, somewhat similar to the PL/1 fixed type.


That would be nice, too, but what if you need decimal FLOAT?

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 #543
In comp.std.c Morris Dovey <mr*****@iedu.c om> wrote:

Mike Cowlishaw wrote:

This would mean that one could never have both binary and
decimal FP data in the same program/structure.
True. Would that necessarily be a problem? The only occasions I
can imagine would be (one time) database conversions.


Yes, it would be a very big problem. What if the GUI library you want
to use is written with FP-10 and the statistical analysis library you
want to use is written with FP-2? *Those* are the kinds of issues that
will arise and cause the most problems.
[1] Assuming the standard were changed to include FP-10, will the
compiler producers consider the new standard non-relevant, given
that it covers hardware not now available anywhere in the world?


The standard could be changed to accomodate FP-10 without requiring it.
I sincerely doubt that the standard would mandate FP-10 without a broad
concensus among both users and implementors that that was the right
thing to do.

-Larry Jones

It must be sad being a species with so little imagination. -- Calvin
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #544
Keith Thompson wrote:

"Eric Backus" <er*********@al um.mit.edu> writes:
[...]
If anything, don't the benchmark and the associated decimal floating-point
library you used prove that this *can* be solved without putting the
floating-point into hardware and into C?


I think the relevant question is, will decimal floating-point be
implemented in hardware? If so, and if IBM isn't the only hardware
manufacturer to do it, then C should accomodate it.


C has a mechanism to accommodate many innovative hardware features -- a
library function. This can be used without changing the language. If
putting direct hardware access into the language is a good idea, how
about C language direct support for hardware interrupts? power down
modes? I'm not suggesting these, just pointing out that new hardware
features are not a adequate reason to change the language.

Thad
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #545
Keith Thompson wrote:
"Eric Backus" <er*********@al um.mit.edu> writes:
[...]
If anything, don't the benchmark and the associated decimal floating-point
library you used prove that this *can* be solved without putting the
floating-point into hardware and into C?

I think the relevant question is, will decimal floating-point be
implemented in hardware? If so, and if IBM isn't the only hardware
manufacturer to do it, then C should accomodate it.


It may or may not be relevant, but PL/I has supported FLOAT DECIMAL
since the beginning, even though no implementation that I know of
actually does it with decimal arithmetic. Having the attribute allows
precision to be specified in decimal digits instead of binary bytes.

If an implementation actually did have decimal float hardware, the
attribute is there and ready to use. IBM compilers usually do FIXED
DECIMAL with BCD hardware instructions, though.

-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #546
Francis Glassborow wrote:
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu.c om> writes
[3] What will be the cost of adding a second (if FP-10 doesn't
simply replace FP-2) floating-point processor to all CPUs? ...

Looking at the latest CPUs with multiple pipelines etc. I suspect that
this is an entirely non-issue.


Actually it would be expensive to add another floating
coprocessor to the silicon, although if done as a mode
(binary/decimal) the cost would be reduced. There are
some who think it likely that either binary or decimal
f.p. (but not both) would be supported by the chip-level
hardware on some platforms. On more "mainframe"-like
platforms it is more likely that both would be supported.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #547
la************@ eds.com wrote:
The standard could be changed to accomodate FP-10 without requiring it.
I sincerely doubt that the standard would mandate FP-10 without a broad
concensus among both users and implementors that that was the right
thing to do.


Note that IEEE/IEC binary floating point has an optional
binding to the C standard, and presumably 754R decimal
floating point could have a similar binding. The generic
support for decimal floating point could be specified so
that both binary and decimal were specifiable by the
programmer, but could be implemented using the same
representation (for non-IEEE/IEC decimal-f.p. platforms),
much as "int" and "long" have the same representation on
many platforms.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #548
In <cl************ ****@plethora.n et> ge***@mail.ocis .net (Gene Wirchenko) writes:
That would be nice, too, but what if you need decimal FLOAT?


What for? Given the intrinsic nature of floating point, if the base is
relevant to your application, then you should review the application.

If the ability of representing $3.11 *exactly* is important, simply do all
your computing in pennies and the base used by your floating point
representation no longer matters (only the precision is relevant).

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 #549
In comp.lang.c.mod erated Eric Backus <er*********@al um.mit.edu> wrote:
Is IBM really suggesting that new financial programs be written in C?
Let me answer this with another question: Would you prefer that they
forever keep being written in COBOL, instead?

Since legal requirements in the financial sector (tax calculations and
such) explicitly require decimal arithmetic and certain rounding
rules, having support for decimal FP in C could help put COBOL to its
long-deserved final sleep.

I'm all for it, _as_long_as_ it doesn't interfere with existing code.
Scientists will insist that behaviour of existing code that does rely
on FP being done in base 2 doesn't change. I.e. there really should
be a set of new types and library support for the guaranteed-decimal
FP. Overlaying the existing ones with base-10 ones isn't a viable
alternative, IMHO. To put it technically: existing code that does
(or should) have a fragment like

#include <float.h>
#if FLT_RADIX != 2
# error Sorry, this program only works in base-2 floating point!
#endif

inside _must_ continue to work, or you'll invoke on your heads the
wrath of the entire scientific community.
why does a low-level language like C need it?


Because it's the common-ground low-level language many other languages
(more precisely: their runtime libraries) are built on top of.

If you view C as "portable assembler", then C should support as many
aspects of assembler programming as remotely possible. CPUs with more
than one base available for floating point operations, or base-10 as
the native one, would be one such aspect that it currently doesn't
handle well.

--
Hans-Bernhard Broeker (br*****@physik .rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #550

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