473,889 Members | 1,387 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 23915
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu.c om> writes
[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?


Yes... where appropriate. Ie FP-10 will never become available in many
architectures. However I think it is likely to become common on many
others. Therefore compilers will support it.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #561
Da*****@cern.ch (Dan Pop) writes:
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).


This doesn't work very well if you want to buy a gallon of gasoline.

(In the US, gasoline is priced in dollars per gallon, with 3 digits
after the decimal point; the third digit is almost always 9. For
example, I recently paid $1.599/gallon. Back when gasoline was a lot
cheaper, I think the idea was that $0.299 looked less expensive than
$0.30; unfortunately, the tradition has continued.)

Stock prices are also sometimes expressed in fractional cents.

And compound interest is calculated by a set of rules that I don't
pretend to understand.

--
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 #562
Da*****@cern.ch (Dan Pop) wrote:
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu> writes:
It may or may not be relevant, but PL/I has supported FLOAT DECIMAL


It is relevant. PL/I was designed to be the ultimate programming
language and it failed big time. Therefore, it should be considered an
excellent example of how NOT to do things ;-)


And you wish to lay that all at the feet of decimal floating
point? PL/I also had semicolons to end statements and a number of
other things that C has.

How about we carefully consider any proposed changes instead,
regardless of whether the features have been used before?

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 #563
>> It may or may not be relevant, but PL/I has supported FLOAT DECIMAL

It is relevant. PL/I was designed to be the ultimate programming
language and it failed big time. Therefore, it should be considered
an excellent example of how NOT to do things ;-)


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

Mike Cowlishaw
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #564
Thad Smith wrote:
While I encourage anyone that wants to extend their own compiler with
decimal arithmetic, I am seeing, in the embedded compiler community,
the increasing resistance to follow the Standard with increasingly
complex compilers to support features not usually required by their
customers. Apparently this resistance applies to other platforms as
well. Adding more special purpose features makes the situation
worse, IMO.


I would agree, except for the implication that decimal arithmetic is
a 'special purpose feature'. Decimal arithmetic is far more pervasive
than binary arithmetic. It is the arithmetic used by every numerate
person in the world, and in commercial databases decimal data
columns are 25 times more common than binary.

What's happening here is that hardware is adding a new primitive
data type which is useful for far more applications than binary
floating-point. It's probably more appropriate for 'embedded'
machines, too, as the reduced complexity and simpler conversions
save both time and space. In fact, programming languages
above the assembler level need *only* a decimal type, as
integers (and fixed point) data types are a subset of the
decimal floating-point type. The latter is where the decimal
754R types differ quite radically from the binary types.

Mike Cowlishaw
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #565
In <cl************ ****@plethora.n et> "Mike Cowlishaw" <mf*****@attglo bal.net> writes:
Dan Pop wrote:
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).


This does not work, because applications are constantly changing.
Items are often costed in sub-penny decimal units; taxes are now
sometimes specified to 4 or 5 decimal places. The scaling factor
you need to apply, to get exact results, is difficult to work out, and
has to be updated often as the data changes. And if the application
designer or maintainer doesn't allow enough fractional digits, all
of a sudden results become Inexact, with no indication.


This is trivially handled by defining the scaling factor as a macro.
The precision of an IEEE 754 double allows enough space for that, without
limiting the range of precise representations too much for the needs of
the usual financial application.

And what is the exact result of dividing 1 penny by 3, when using
decimal floating point arithmetic? Or is division a prohibited operation
for this class of applications?

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 #566
Dan Pop wrote:
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).


I think I agree 100% with these statements, but not everyone else does,
and not everyone even understands what they mean.

To me, it would almost be worth it for the reduction in posts asking why
some operation comes out 24.299999 when it obviously should be 24.3.

Maybe if a license was required before one was allowed to use floating
point arithmetic, but that isn't likely anytime soon.

-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #567
In <cl************ ****@plethora.n et> "P.J. Plauger" <pj*@dinkumware .com> writes:
Certainly the proposal accepted by both the C and C++ committees
calls for a parallel set of FP capabilities, but I confess I'm
a long way from being convinced that such added complexity is
either necessary or desirable. I *am* convinced that fleshing
out IEEE 754R decimal FP arithmetic as an alternative representation
for the existing three FP builtin types is quite viable.


Can this be done without changing the current floating point model of the
C standard? IIRC, the IEEE 754R specification goes beyond merely
specifying base 10. Are the other details compatible with the C floating
point model?

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 #568
In <cl************ ****@plethora.n et> Chris Hills <ch***@phaedsys .org> writes:
In article <cl************ ****@plethora.n et>, Morris Dovey
<mr*****@iedu. com> writes
[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?


Yes... where appropriate. Ie FP-10 will never become available in many
architecture s. However I think it is likely to become common on many
others. Therefore compilers will support it.


There's no question of supporting it in the compiler if the hardware
supports it. The question is about the perspectives of a C standard
mandating unconditional support for it, on platforms with no hardware
support for it.

For the time being, the perspectives of C99 as an industry standard are
not particularly bright...

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 #569
In comp.lang.c.mod erated P.J. Plauger <pj*@dinkumware .com> wrote:
"Hans-Bernhard Broeker" <br*****@physik .rwth-aachen.de> wrote in message
news:cl******** ********@pletho ra.net...
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.

You really think so?
Yes. Been there, done that. It was big High-Energy Physics
experiment, with a total project time of more than a decade, and still
counting. Lots of computations go on between the actual raw data
taking and the output of published results. At least 3 generations of
computer hardware were involved over the time the experiment has been
running, and they want to be sure that changing the FPU doesn't affect
the results. Not even minimally. Result was that they decided to
re-configure the Intel FPUs to turn of their "excess" precision.
These guys would be *very* upset if a compiler came out that no longer
supported binary FP.
Most `scientists' I know are content to have their FP calculations
produce results that look more or less reasonable to, say, a dozen
decimal places.


Then may you only know `scientists' (including the quotes), but no
actual scientists.

I see no problem adding new features to the language. But the day you
start removing features is when you may be causing real trouble for
people out there.

Actually, if the plan were to just use decimal FP *instead* of the now
common binary FP, there would be nothing for the committee to decide
about, as far as I can see. A platform with FLT_RADIX==10 should be
perfectly compliant right now, as far as I can see. It might enrage
some potential users and steer them away from such a platform, but
that's an economic risk for its vendors to worry about rather than a
concern for the C standardization comittee.

The only thing the current standard(s) doesn't support, and thus
requiring an actual committee decision, would be having more than one
FP base available on the same platform, to be used within the same
program. And once you support more two, you have to make essentially
3 substantial decisions:

1) Whether to prescribe which of them is used as good old float,
double & surrounding tools, or leave that to the implementors
2) If so, which one to prescribe.
3) Whether to make support for the known-base types optional or mandatory

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11267
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
31469
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
11187
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
10784
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
10887
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
9602
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
7991
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
7148
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
5825
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
6021
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
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

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.