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
"Douglas A. Gwyn" <DA****@null.ne t> writes:
Dan Pop wrote:
This is, by far, the cleanest approach. Introduce something like
dfloat, ddouble and long ddouble and <dmath.h> and make them optional
(a macro in the implementation name space will indicate whether the
implementation supports them or not).


Unfortunately there are good arguments against that approach.
Ultimately the specification will be the result of negotiating
a consensus on the right balance among the competing factors.


Decimal floating-point isn't intended to *replace* binary
floating-point, is it?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
(Note new e-mail address)
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #501
After reading comments on the proposed decimal fp standardization for C
and C++, I began
thinking more generally about the process of standardizing useful
features, I wonder if it is time to put effort into standardizing on two
(or possibly more) distinct levels: the core language, which should be
fairly stable, and add-on packages to suit various applications, such as
financial calculations.

There are many other such application types that would benefit from
extensions and standardization as have been mentioned here: extended
time/calendar calculations, extended scientific calculations, file
system control, external binary formatting, multi-threaded control, GUI
support, etc. Does it make sense to standardize these? I think so.
Does it make sense to attempt to put these all in one language
standard? I doubt it. I think the standard becomes too complex and
cumbersome.

Yes, there are add-on libraries to address these extended needs. Some
of these attempt to define a standard. Many are primarily targeted to
specific platforms and don't port well or are simply ignored when
implementing something for a different platform, vendor, etc.

Does a two-tiered system for standardization make sense? Will it work?
Has it been shown to work or fail in other instances?

Thad
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #502
On 11 Nov 2003 19:53:12 GMT in comp.lang.c.mod erated, Fergus Henderson
<fj*@cs.mu.oz.a u> wrote:
Ben Pfaff <bl*@cs.stanfor d.edu> writes:
"Douglas A. Gwyn" <DA****@null.ne t> writes:
Exactly how the C standard will accommodate this is still an
open question; we might simply revise the floating-point model
to allow float, double, and long double to use decimal
representation, [...]


Doesn't it already? FLT_RADIX is constrained to be greater than
or equal to 2, which doesn't preclude decimal representation
as far as I can tell.


In theory, perhaps; but in practice, no, because backwards compatibility,
binary compatibility, and compatibility with other standards would prevent
implementation s from defining `float' and `double' with decimal
representation s. The only feasible way of supporting decimal floating
point in C would be for it to be a new type, rather than replacing one
of the existing types.


Not at all -- IBM M/F 360/370/390 native compilers use FLT_RADIX 16 --
and newer systems also support IEEE FP -- so supporting another FP
option would only be a SMOP.
Has any machine ever supported *hardware* *decimal* *floating point*
arithmetic? Not *fixed* (un-/packed) decimal arithmetic, which
requires the programmer or compiler and library to do the scaling, and
not software decimal floating point.
--
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 13 '05 #503
On 13 Nov 2003 02:52:50 GMT in comp.lang.c.mod erated, Keith Thompson
<ks***@mib.or g> wrote:
"P.J. Plauger" <pj*@dinkumware .com> writes:
[...]
One possibility the C and C++ committees will have to explore is simply
rounding out the consequences of having an implementation where float,
double, and long double are these new decimal formats instead of binary
IEEE 754 and its ilk. That's a *very* lightweight change, from a language
point of view, because the C Standard already permits decimal floating
point. The folks who have to do the heavy lifting are us library
implementors, who have many math functions to convert over. (We'll have
to do that for *any* approach.)

[...]

Hmm. I'm a bit skeptical that the existing floating-point types can
be made decimal without breaking existing code, especially scientific
code. No, the standard doesn't guarantee that the existing types are
binary, but it's a common assumption.

My concern is that existing code, compiled with a new compiler, could
produce subtly different results.

One obvious solution would be to provide, say, a command-line option
that makes the predefined types binary, but then the semantics of the
program would depend on the source code plus the command-line options.


C compilers for IBM 360/370/390 MFs have supported native hexadecimal
FP for years; newer compilers also now support IEEE (binary) FP on
their newer MFs; adding decimal FP as a third option should be easier
on those compilers than others that have not dealt with that
possibility.
GCC could fairly easily add submodel options such as
-mfpmath={2|10|1 6} or -mfp{b|d|h} as such options already exist for
M68K, i386, VAX, and other target architectures, although not sure
whether float.h definitions differed with any of these targets.
--
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 13 '05 #504
In article <cl************ ****@plethora.n et>,
Keith Thompson <ks***@mib.or g> wrote:
"Douglas A. Gwyn" <DA****@null.ne t> writes:
Dan Pop wrote:
This is, by far, the cleanest approach. Introduce something like
dfloat, ddouble and long ddouble and <dmath.h> and make them optional
(a macro in the implementation name space will indicate whether the
implementation supports them or not).
Unfortunately there are good arguments against that approach.
Ultimately the specification will be the result of negotiating
a consensus on the right balance among the competing factors.


Decimal floating-point isn't intended to *replace* binary
floating-point, is it?


An implementation could replace binary floating-point with decimal
floating-point; the C Standard doesn't require that floating point is
binary. Since decimal floating point is likely to be hundred times
slower than binary floating point on the computer you are using right
now, such an implementation wouldn't be very popular :-(
From what I am reading, it seems that decimal floating point will

definitely be added to the IEEE 754 standard. In C++ decimal floating
point could be added quite easily as a class; no change in the compiler
needed, same as complex. In C, decimal floating point would have to be
added as proper new datatypes. I must say I would prefer if C++ did it
the same way.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #505
Brian Inglis wrote:
Has any machine ever supported *hardware* *decimal* *floating point*
arithmetic? Not *fixed* (un-/packed) decimal arithmetic, which
requires the programmer or compiler and library to do the scaling, and
not software decimal floating point.


Yes. The IBM 1620 used variable length (up to 99 digits, with
2 digits of exponent) of BCD (binary coded decimal) as its only
floating-point type. This was done in hardware (but the hardware
used addition and multiplicatoin tables in user memory -- nasty
bugs resulted if you ever altered those tables).
This was the first machine I programmed on, back in 1967.
---
Fred J. Tydeman Tydeman Consulting
ty*****@tybor.c om Programming, testing, numerics
+1 (775) 287-5904 Vice-chair of J11 (ANSI "C")
Sample C99+FPCE tests: ftp://jump.net/pub/tybor/
Savers sleep well, investors eat well, spenders work forever.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #506
Francis Glassborow wrote:
In article <cl************ ****@plethora.n et>, Thad Smith
<th**@ionsky.co m> writes
Francis Glassborow wrote:
During the last two weeks of October WG14 (C) and WG21
(C++) both voted to work on providing decimal floating
point types.
Where did the impetus for this originate?


IBM


<snip concurrency, C++ remarks>
Why is the C committee considering this?


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


I'm having difficulty finding the point of these arguments.
Perhaps my experiences with binary floating point in commercial
applications has clouded my ability to see the "need" to emulate
decimal floating point.

I have no difficulty believing that if one were to require that
computations be performed in a radix 10 floating point, then a
hardware radix 10 capability would be orders of magnitude faster;
but I do have difficulty finding the "need" to perform those
computations in /any/ particular floating point radix.

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.

Has WG14 made the decision that the needs of "typical billing
programs" should determine the C language architecture and
associated standards?

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?
The exact way that C and C++ might utilise future decimal FPUs
is open for discussion but we are quite certain that if these
languages are to remain competitive (in overall performance)
for commercial applications we need to tackle the issue in a
timely fashion.
A certain amount of sarcasm might be appropriate at his point.
I'd be inclined to suggest a that a reworking of those portions
of the standard dealing with the commercial basics of /time/ and
/money|currency/ might be even more important and pressing set of
issues than the performance of a subset of a limited range of
applications.

[I recall a thread some time ago on comp.lang.c in which one of
the committee members mentioned that it was _IBM's_ desire to
ignore prior art and existing practice by rendering time_t
useless to application 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?
We are also certain that the two languages should tackle their
support in a way that ensures compatibility of code even
though C is likely to provide new fundamental types and C++ is
likely to work with library types. We do not want the problems
(small though they are if code is written carefully) that
surfaced through the independent support of complex types in C
and C++.
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.
In addition it is a matter of choosing a single item to work
on though concurrency is far more demanding and hard to get
right.


This sounds like a really good rationale for deleting the last
four letters from "COBOL" and using that standard. Much less
demanding; and if it has flaws you can always point at someone
else...
--
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 #507
On 11 Nov 2003 19:53:57 GMT in comp.lang.c.mod erated, "P.J. Plauger"
<pj*@dinkumware .com> wrote:
"Thad Smith" <th*******@acm. org> wrote in message
news:cl******* *********@pleth ora.net...
Thanks P.J., Francis, and Douglas, and Fred for your helpful and
informed responses. I suspect there are other regular readers here that
were as surprised as I am about the proposal. IF decimal f.p. is going
to be added to both languages, it certainly makes sense to make them
compatible.

My bias is that decimal arithmetic is more the domain of Cobol and
PL/I. Perhaps it is time to add this support to other popular
languages. My first thought was "OK, add it to C++. It should be
relatively easy. Programmers who want decimal f.p. can use C++. C is
more for system routines and embedded applications that don't have much
demand for decimal f.p."

If that viewpoint is out of touch, please clue me in. ;-)
What's new here is the engineering that has gone into IEEE 754R. We now
have an encoding of decimal floating point with many desirable properties,
not the least of which is the potential for speed and storage economy
comparable to existing binary floating point. And we have IBM's public
commitment to producing hardware that uses this format.


Fairly easy for IBM, as they have the relatively recent experience of
adding IEEE FP support to their M/F compilers which only supported
their hex radix FP previously. Any other interest in building decimal
FP hardware, as from Intel or AMD?
One possibility the C and C++ committees will have to explore is simply
rounding out the consequences of having an implementation where float,
double, and long double are these new decimal formats instead of binary
IEEE 754 and its ilk. That's a *very* lightweight change, from a language
point of view, because the C Standard already permits decimal floating
point. The folks who have to do the heavy lifting are us library
implementors , who have many math functions to convert over. (We'll have
to do that for *any* approach.)

A slightly heavier possibility, which is more what IBM has proposed, is
to introduce decimal floating point alongside whatever the builtin
floating-point types currently provide. Doing that requires either adding
three more builtin floating-point types (certainly in C, possibly also in
C++), or adding some second-class citizens (easier in C++, thanks to
operator overloading).
Seems to be somewhat contrary to the "spirit of C" and existing
approaches where FP implementation variations are code gen and library
function options, and FP radix an implementation detail.
A still heavier possibility is to stick with just three builtin types,
which are either binary or decimal, and provide for *two* sets of
second-class citizens. One of these would be assuredly binary, the
other assuredly decimal. And one of the two would have the same
representati on as the builtin types. That makes sense only if we can
demonstrate a clear need for both forms of arithmetic within one
program.
If the hardware, compiler, and library implementations are comparable,
are there many applications where properties of tuned binary FP
algorithms and decimal FP requirement are both required?
It's too soon to say what the best solution will be, but at least the
two committees will be in close communication during the exploration
and development.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com


--
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 13 '05 #508
Keith Thompson wrote:
Decimal floating-point isn't intended to *replace* binary
floating-point, is it?


Several people think that on many platforms it might.
There would be a large cost in supporting both in a
microprocessor implementation.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #509
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?

It would be great for some language with suitable support
for packaging to have a set of optional packages that did
not intrude if the ackages weren't used. C is not such a
language.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #510

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

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.