473,883 Members | 1,656 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 23866
Keith Thompson <ks***@mib.or g> writes:
I think you need another suffix to specify that a literal is decimal:

d_double x = 0.1D;

but forgetting the suffix is likely to be a common subtle error.


Compilers could easily warn about it, though.

--
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.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #521
"Douglas A. Gwyn" <DA****@null.ne t> writes:
Thad Smith wrote:
Does a two-tiered system for standardization make sense? Will it work?
Has it been shown to work or fail in other instances?


COBOL had various levels of conformance, and generally all
it accomplished was complication. In practice all implementations
ended up providing all the levels, so what was the point?


Are you sure? If so, how long did it take for this to occur?

The COBOL implementation that I used in my time as a COBOL programmer
(1988-1992), namely ACUCOBOL, did not support all of the optional
features in the COBOL-85 standard. In particular it lacked support for
nested subprograms.

A web search pulled up some documentation for ACUCOBOL-GT, dated >= 1995
(since it refers to Windows 95), which indicates that this is was still
the case then, ten years after the adoption of the COBOL-85 standard.

--
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.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #522
James Kuyper wrote:
Morris Dovey wrote:
....
(Short reminder that I'm an "ordinary programmer" - and not a
language guru [IANAG])
The need for high degrees of precision in computation is not a
new issue and I fail to see how a change in radix will provide a
major improvement.


It's not "high degrees of precision" that are needed. It's a
fairly low degree of precision, but it needs to be provided
exactly, which makes is similar in some ways to requiring
infinite precision.


I'm going to have to think about this statement for a while. I'm
mulling over simple arithmatic operations like 1/3, 1/7, etc.;
and asking myself: "What's improved by performing this operation
in FP-10?" Am I grossly missing the point?
Has WG14 made the decision that the needs of "typical billing
programs" should determine the C language architecture and
associated standards?


Apparantly they've decided that those needs should be considered. Your
use of "determine" is a loaded phrase; taken to it's logical extreme,
your criticism implies that the C standard should never contain any
feature that is needed only by a minority of the users. In fact, most of
C's features are needed only by a minority, especially in the C standard
library. A great many programs make no use of floating point at all,
whether binary or decimal.


Unfair of me. I apologize. I value C as a "tiny" but "rich"
language. I don't worry much about the library (because it's so
easy to expand upon); but feel that the "tiny" and "rich" should
be preserved. In current context, I'd feel very much more at ease
if the change under consideration was to standardize a compiler
switch to produce code using a particular floating point radix;
and perhaps specifying (and requiring) conformance to specific
IEEE standards for each radix supported.

The addition of a decimal floating point type to the C standard
would seem to me burdensome to those who produce compilers for
"small" embedded systems, for example. Fully conforming compilers
are scarce enough already. If the core language becomes
sufficiently bloated, I'm concerned that the standard will become
(or be perceived by implementors as) non-relevant. Note that I'm
/not/ saying that FP-10 wouldn't be useful in embedded systems.
Would anyone care to wager that "the typical billing program"
/cannot/ be improved by overall factors in excess of three even
if decimal floating point is not provided?


It's not an issue where improvement can be measured in terms of "[a]
factor in excess of three". The key point is that the financial
community has a commonly occuring need for the numbers, as printed with
a fixed number of decimal places, to add up exactly to the specified
total printed with the same number of decimal places, without roundoff
error. In general that will happen only when using a radix that is a
power of 10. One solution is to use scaled integers, such that an
integer such as 3412 represents a value of 34.12. However, use of scaled
integers complicates programs; a common problem is forgetting to apply
the scale factor, or applying it inappropriately .


I guess I should have put a smiley on that statement - but I'd
like to respond seriously to your serious response. When PHLX
(The Philadelphia Stock Exchange) switched from fractional prices
to decimal prices in 2000, they switched from scaled integers to
binary floating point. The difficulties you present were examined
and efficient solutions implemented. It was a highly educational
process for all involved since we nearly all "knew" (at the
beginning) that floating point wasn't any good for monetary
values. My discovery was that the problem didn't lie with the
hardware or the format - it lay with the uninformed prejudice of
programmers.
....
Since when (and by whom) has there been a declaration that C is
competing (with whom and for what) as a tool for building
commercial applications? Is the term "panacea" being added to the
language definition? The term "commercial " describes most of the software that has ever been
written in the C language. I suspect you may mean "financial" rather
than "commercial ". There's a lot more freeware out there nowadays, but
most programs still have to be paid for.
Yup. I did mean "financial" . Sorry for the ambiguity. I'm a bigot
who likes freeware and who likes to be paid for designing and
writing programs (and of late, compiling the paid for code with
freeware compilers.)

What I was reacting to was the notion that the C language is
somehow engaged in a competition for the financial community's
attention. That notion struck me as particularly silly because
the financial community is perfectly aware of C and hasn't (in my
experience) needed to be "sold" on the idea of using it.
C has always been meant to be a general-purpose language. That's similar
to "panacea", but not as ambitious. It's not meant to be the ideal
solution for every problem, but it's meant to be an acceptable solution
for a wide variety of problems. It's a low-level language, far closer to
assembly language than many others, but not so low-level as to be
inappropriate for some financial applications.


/Exactly/ so!
Given that the floating point radix has never been restricted to
any particular value, you should probably not contract the
language definition at this point by deciding that you've fallen
in love with ten. My sense is that any requirements (other than
the specific radix value, of course) for one radix should also be
in force for all others.


I think you're under the mistaken impression that decimal floating point
is being proposed as a replacement for binary floating point. Such a
mistake would make your criticisms seem more appropriate. My
understanding was that the proposal is to add support for decimal
floating point types, in addition to the default types, not that it
would be a mandatory re-interpretation of them.


Never wanting to miss an opportunity to display my considerable
ignorance, why not leave selection of floating point radix a
compile/link option? I've been thinking back over all the
financial code I've ever written/seen and can't think of any
instance where use of more than a single floating point radix
made any sense at all. Why not simply use the type names we
already have?

If there is a strong desire to "marry" a program to a particular
radix, then why not just do so with a

#pragma fp_radix 10

or similar.

(After a break for a cup of coffee and a bit of soul searching) I
think I'm skeptical about the need for additional types rather
than simply being reactionary. I just don't see how a new FPU
architecture "under the covers" necessitates a language change.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c
Read my lips: The apple doesn't fall far from the tree.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #523
Mike Cowlishaw wrote:
Morris Dovey wrote:
I haven't found any references to IBM patents covering decimal
floating point implementations . Does IBM hold and/or have
application(s ) pending for such patents? If so, are those patents
sufficientl y broad as to exclude other hardware producers from
producing decimal FPUs of equal (or better) performance at equal
(or better) cost?
The only one that I am aware of that directly affects the decimal
formats in the draft IEEE 754 revision is the IBM patent which
covers my Densely Packed Decimal encoding scheme,
described at:

http://www2.hursley.ibm.com/decimal/DPDecimal.html


(Nice work, by the way)
(This was patented before we considered proposing it for use
in IEEE 754.) IBM has already written the necessary formal
letter to the IEEE stating that this will be Royalty Free for
implementers of the standard (rather than RAND), though
RAND is permitted by IEEE rules. We really want to see
everyone using the new formats!
First class! My personal experience of IBM was that the people in
the labs were generally bright white hats; but that it hasn't
necessarily always been so throughout the remainder of the
corporation. Due diligence would require that the question be
asked regardless of the source of the proposal.
There are, of course, many patents issued to IBM and
other companies that cover various aspects of floating-point
arithmetic (both binary and decimal). These might constrain
certain methods of implementation, but would not prevent
implementation -- any 'obvious' implementation would not
be covered by patents, and many early patents on decimal
arithmetic have long since expired, in any case.


Understood from the outset. I've always thought of IBM as a
patent factory; and that's at least partly why I asked right out
loud. 8-)
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c
Read my lips: The apple doesn't fall far from the tree.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #524
"P.J. Plauger" <pj*@dinkumware .com> wrote in message
news:cl******** ********@pletho ra.net...

IBM gave an excellent presentation on the need for decimal arithmetic in
a large proportion of calculations being performed these days. (Most tax
and interest laws specify decimal algorithms, which are hard to emulate
correctly with binary.) They also described the implementation being
developed as part of IEEE 754R, the current revision to the venerable
binary floating-point standard. And they informed us that they will be
producing CPUs with this arithmetic implemented in hardware.

I can tell you that both the C and C++ committees were skeptical at
the outset and pretty thoroughly convinced in the end. They've even
agreed to *cooperate* [sic] to ensure that C and C++ remain compatible
in this area.


Is IBM really suggesting that new financial programs be written in C? That
doesn't sound like a very good idea. I can maybe see putting support in
hardware, if this really is a speed bottleneck (which, frankly, I doubt) but
why does a low-level language like C need it? Surely a financial program
would use C++ or something higher level than that, and surely you would have
some standard class that deals with decimal arithmetic in a standard way.
How did they justify wanting to put it into C?

--
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 #525
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu.c om> writes
Never wanting to miss an opportunity to display my considerable
ignorance, why not leave selection of floating point radix a
compile/link option? I've been thinking back over all the financial
code I've ever written/seen and can't think of any instance where use
of more than a single floating point radix made any sense at all. Why
not simply use the type names we already have?


WG14 will take time to consider all the options but the proposal from
IBM is for something that is considerably more than just a change of
radix.

The second issue is that tuning math libraries to work effectively
requires a great deal of skill and time. You cannot simply change the
radix and expect everything else to work.

I think that the fact that a total of nearly 100 largely sceptical
'experts' (some C some C++) have decided that they should take (a lot
more) time considering the issues might suggest that there was more to d
o than to just flick a switch for a different radix.
--
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 #526
Morris Dovey wrote:
The addition of a decimal floating point type to the C standard would
seem to me burdensome to those who produce compilers for "small"
embedded systems, for example.


Naturally it depends on details, but generally speaking it's
a relatively small burden compared to some other areas in
which C99 extended the language. Also, just because a system
is small doesn't mean that decimal floating point isn't
important to it. Some embedded systems would benefit greatly
from better support for this.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #527
Morris Dovey wrote:
The need for high degrees of precision in computation is not a
new issue and I fail to see how a change in radix will provide a
major improvement. It's not "high degrees of precision" that are needed. It's a
fairly low degree of precision, but it needs to be provided
exactly, which makes is similar in some ways to requiring
infinite precision.

I'm going to have to think about this statement for a while. I'm
mulling over simple arithmatic operations like 1/3, 1/7, etc.;
and asking myself: "What's improved by performing this operation
in FP-10?" Am I grossly missing the point?


Perhaps so. Even with those divisions base 10 helps a little,
because the result you get will always be the same as a 'manual'
calculation of the same operation.

But the real benefits are where the results are expected to be
exact, or certain rounding rules must be strictly applied.
See the section 'What problems are caused by using binary floating-point?'
in: http://www2.hursley.ibm.com/decimal/decifaq.html
Would anyone care to wager that "the typical billing program"
/cannot/ be improved by overall factors in excess of three even
if decimal floating point is not provided?


It's not an issue where improvement can be measured in terms of "[a]
factor in excess of three". The key point is that the financial
community has a commonly occuring need for the numbers, as printed
with a fixed number of decimal places, to add up exactly to the
specified total printed with the same number of decimal places,
without roundoff error. In general that will happen only when using
a radix that is a power of 10. One solution is to use scaled
integers, such that an integer such as 3412 represents a value of
34.12. However, use of scaled integers complicates programs; a
common problem is forgetting to apply the scale factor, or applying
it inappropriately .


I guess I should have put a smiley on that statement - but I'd
like to respond seriously to your serious response. When PHLX
(The Philadelphia Stock Exchange) switched from fractional prices
to decimal prices in 2000, they switched from scaled integers to
binary floating point. The difficulties you present were examined
and efficient solutions implemented. It was a highly educational
process for all involved since we nearly all "knew" (at the
beginning) that floating point wasn't any good for monetary
values. My discovery was that the problem didn't lie with the
hardware or the format - it lay with the uninformed prejudice of
programmers.


It is indeed possible, with great care and skilled error analysis, to
use binary floating point for some financial applications (especially
those where no calculation takes place .. numbers are just moved
around). But it is hard and unnecessarily complicated -- and as
soon as the application is modified or maintained, 'accidents' are
just waiting to happen. It's faster (given the hardware), simpler,
and easier to use base-10 arithmetic.
Never wanting to miss an opportunity to display my considerable
ignorance, why not leave selection of floating point radix a
compile/link option? I've been thinking back over all the
financial code I've ever written/seen and can't think of any
instance where use of more than a single floating point radix
made any sense at all. Why not simply use the type names we
already have?


This would mean that one could never have both binary and decimal
FP data in the same program/structure. A pragma which could be used
inside a program would be especially dangerous (consider the
base being switched inside an #include). The entire existing base
of binary FP functions could not be used from a program which
selected base 10.

Mike Cowlishaw
Google: decimal arithmetic
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #528
Eric Backus wrote:
"P.J. Plauger" <pj*@dinkumware .com> wrote in message
news:cl******** ********@pletho ra.net...

IBM gave an excellent presentation on the need for decimal
arithmetic in a large proportion of calculations being performed
these days. (Most tax and interest laws specify decimal algorithms,
which are hard to emulate correctly with binary.) They also
described the implementation being developed as part of IEEE 754R,
the current revision to the venerable binary floating-point
standard. And they informed us that they will be producing CPUs with
this arithmetic implemented in hardware.

I can tell you that both the C and C++ committees were skeptical at
the outset and pretty thoroughly convinced in the end. They've even
agreed to *cooperate* [sic] to ensure that C and C++ remain
compatible
in this area.
Is IBM really suggesting that new financial programs be written in C?


Not necessarily -- but remember that the interpreters and compilers
for just about every other language are written in C. Without the
decimal support in C, all these languages would have to switch to
assembler code to access the decimal instructions.
That doesn't sound like a very good idea. I can maybe see putting
support in hardware, if this really is a speed bottleneck (which,
frankly, I doubt)
See, for example, the 'telco' benchmark at:
http://www2.hursley.ibm.com/decimal/telco.html
but why does a low-level language like C need it?
Surely a financial program would use C++ or something higher level
than that, and surely you would have some standard class that deals
with decimal arithmetic in a standard way. How did they justify
wanting to put it into C?


Again: how would one write that class without the primitive
types in the language?

Mike Cowlishaw
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #529
In <cl************ ****@plethora.n et> Francis Glassborow <fr*****@robint on.demon.co.uk> writes:
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu. com> writes
Never wanting to miss an opportunity to display my considerable
ignorance, why not leave selection of floating point radix a
compile/link option? I've been thinking back over all the financial
code I've ever written/seen and can't think of any instance where use
of more than a single floating point radix made any sense at all. Why
not simply use the type names we already have?


WG14 will take time to consider all the options but the proposal from
IBM is for something that is considerably more than just a change of
radix.


This is what I've understood from Plauger's post, too, hence my option
for different types and a different standard header. If it were just a
change of radix, while keeping the floating point model of the C standard
unchanged, everything could be left up to the implementor, with no changes
made to the standard.

If, however, the IBM proposal doesn't fit the C floating point model, it
would be sheer insanity to change the latter in order to accomodate the
IBM proposal.

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 #530

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
9934
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
9789
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
10736
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...
0
9570
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
7969
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
7120
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();...
1
4608
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
2
4214
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3230
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.