473,883 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why still use C?

no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially C++.

i heard people say C++ is slower than C but i can't believe that. in pieces
of the application where speed really matters you can still use "normal"
functions or even static methods which is basically the same.

in C there arent the simplest things present like constants, each struct and
enum have to be prefixed with "struct" and "enum". iam sure there is much
more.

i don't get it why people program in C and faking OOP features(functi on
pointers in structs..) instead of using C++. are they simply masochists or
is there a logical reason?

i feel C has to benefit against C++.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05
687 23893
Kevin D. Quitt wrote:
On 05 Dec 2003 07:23:42 GMT, glen herrmannsfeldt <ga*@ugcs.calte ch.edu>
wrote:
Maybe more relevant here, C++ was an improved version of C

I sure what you meant to say is "C++ was *intended to be* an improved
version of C".


Yes, that is what I meant to say. I must not have been awake enough at
the time.

-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #611
Eric Backus wrote:
..... snip ...
You also get the best possible approximation to the 'ideal' result
if you use binary floating-point. I'm sure you know this, but it's
worth emphasizing anyway: decimal floating point does *not* get rid
of the inexact nature of floating-point operations for the majority
of calculations.


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

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #612
Dan Pop wrote:

(snip)
(I wrote)
There are reasons for that unrelated to the language itself, such as how
long it took to write the compiler, and how slow it ran on machines that
existed at the time.
None of which still applies today. Yet, the usage of PL/I is still
marginal.
In many parts of life, you only get one chance to make it.
It does seem hard to replace an existing language with an improved one. Not at all. FORTRAN IV had little difficulty replacing FORTRAN II and
F77 had little difficulty replacing F66. C89 replaced K&R C in a couple
of years.
Hmmm, I didn't say that right, though you snipped the part about RATFOR
and MORTRAN. It is hard to replace a language with an improved
language that isn't mostly backward compatible. MORTRAN, and I believe
also RATFOR use free format, semi-colon terminated statements. Other
improvements replace hard to use features in Fortran.

Is FORTRAN IV a new language, or a new version of an old language?

Is Fortran 2000 a new language, or an improved version of Fortran II?

It does seem that Fortran-77 hasn't been replaced yet.
Maybe more relevant here, C++ was an improved version of C, possibly
with the intention of converting C programmers to C++ programmers, yet C
is still reasonably popular.

This is the opposite of what you've been arguing above, i.e. the
difficulty of the improved language to become popular.
I don't know if it is opposite or not. How many C programmers converted
to C++ programmers, how many stayed C only programmers, and how many
started as C++ programmers without learning C first? It doesn't seem
that C++ replaced C, though.

C++ is significantly different, yet allows most C constructs to be used.

Though as someone else pointed out I should have said C++ was intended
to be an improved version of C.
Both FORTRAN and COBOL remained popular long after the introduction and
even after the de facto death of the improved PL/I.


-- glen
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #613
In article <cl************ ****@plethora.n et>, Thad Smith
<th**@ionsky.co m> writes
The only time that you get an exact with decimal and not with binary is
when you are dividing by a power or 5, optionally combined with a power
of 2.


True (but the actual proposed form of decimal float has other features
that are useful in some circumstances) but the commercial/financial
world makes extensive use of percentages. Those inherently use division
by powers of five. In addition we have unit pricing that often involves
small fractions of the smallest unit of currency. IOWs we live in a
world where commerce often specifies computations that will be exact if
done in decimal though they will not be in binary.

--
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 14 '05 #614
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu> writes:
It gets conformance with the results people get on pocket calculators,
or when they do long division by hand on paper.
Why is such conformance (up to the last digit) important?
People learn early that one third is a repeating decimal, and one tenth
is not.
People programming computers learn early that this property is neither
true nor relevant when performing floating point computations. Regardless
of the base, floating point numbers are approximations of a subset of the
real numbers (the [-type_MAX, type_MAX] interval).
In the days of billions of transistors on a chip, only a small
percentage need be allocated to decimal floating point hardware.


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

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #615
Thad Smith wrote:

Mike Cowlishaw wrote:

....
Indeed, but there is the huge class of 'interesting' calculations
where using base 10 FP will yield exact results where binary
cannot.


The only time that you get an exact with decimal and not with binary is
when you are dividing by a power or 5, optionally combined with a power
of 2.


What about multiplication by integers, addition, and subtraction? Those
are very common operations, especially in the financial world, and
they're all exact (except when they overflow) when performed in decimal
arithmetic, and inexact when performed in binary floating point. I'm
assuming here that the floating point numbers being multiplied, added,
and subtracted are numbers that binary float can't represent exactly,
but which decimal floating point can, such as 1.10. Such numbers are the
rule, not the exception, in financial calculations.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #616
In <cl************ ****@plethora.n et> James Kuyper <ku****@saicmod is.com> writes:
Thad Smith wrote:

Mike Cowlishaw wrote:

...
> Indeed, but there is the huge class of 'interesting' calculations
> where using base 10 FP will yield exact results where binary
> cannot.


The only time that you get an exact with decimal and not with binary is
when you are dividing by a power or 5, optionally combined with a power
of 2.


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


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

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #617
In <cl************ ****@plethora.n et> glen herrmannsfeldt <ga*@ugcs.calte ch.edu> writes:
Dan Pop wrote:

(snip)
(I wrote)
There are reasons for that unrelated to the language itself, such as how
long it took to write the compiler, and how slow it ran on machines that
existed at the time.
None of which still applies today. Yet, the usage of PL/I is still
marginal.
In many parts of life, you only get one chance to make it.


If PL/I had any compelling merits, I'm sure it would have caught on,
sooner or later. It was certainly not lack of availability of
implementations that caused its failure.
It does seem hard to replace an existing language with an improved one.

Not at all. FORTRAN IV had little difficulty replacing FORTRAN II and
F77 had little difficulty replacing F66. C89 replaced K&R C in a couple
of years.


Hmmm, I didn't say that right, though you snipped the part about RATFOR
and MORTRAN. It is hard to replace a language with an improved
language that isn't mostly backward compatible.


Yet, C brilliantly succeeded. If the improved language has enough merits
on its own, programmers are always willing to make the effort of learning
it. Another example in the scripting languages category is Perl.

The replaced language(s) will be kept alive only by the legacy
applications that still need maintenance, but their usage for new
applications will be marginal. Non-legacy applications are reimplemented
in the new language, to be easier to maintain and enhance.
It does seem that Fortran-77 hasn't been replaced yet.


What people call F77 today is Fortran-77 with a ton of extensions, mostly
inherited from VAX Fortran. I can't remember ever seeing a (non-trivial)
program written in pure ANSI F77.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #618
In comp.std.c Brian Inglis <Br**********@s ystematicsw.ab. ca> wrote:

I think you're just demonstrating programmer inertia -- programmers
want to be able to write the same old code, and *possibly* learn the
best ways to use the new features. IME a lot of "C" programmers were
never very happy using pointers, except to modify function arguments,
preferring Pascal style array indices over C pointers, and Pascal
style I/O processing over C loops with function calls. I suspect a lot
of C/Pascal style code is being written in C++ and Java.


As they say, you can write FORTRAN code in any language.

-Larry Jones

I can do that! It's a free country! I've got my rights! -- Calvin
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #619
Brian Inglis wrote:
herrmannsfeldt <ga*@ugcs.calte ch.edu> wrote:
(snip)

Ratfor, and a few different versions of MORTRAN as Fortran
preprocessors, again with improvements over the original, but
never got very popular.

The original PL/I compiler supplied conversion programs to
convert Fortran, COBOL, and maybe ALGOL to PL/I.

Maybe more relevant here, C++ was an improved version of C,
possibly with the intention of converting C programmers to
C++ programmers, yet C is still reasonably popular.


I think you're just demonstrating programmer inertia --
programmers want to be able to write the same old code, and
*possibly* learn the best ways to use the new features. IME a lot
of "C" programmers were never very happy using pointers, except
to modify function arguments, preferring Pascal style array
indices over C pointers, and Pascal style I/O processing over C
loops with function calls. I suspect a lot of C/Pascal style code
is being written in C++ and Java.


I consider C++ was a marvelous marketing ploy, in that it coaxed C
programmers over by using virtually all their known grammar etc.
The C++ language is probably actually quite competent, but loses
it entirely (IMO) by shoehorning new constructs on top of the
already overly sparse C constructs. In the process it has made
things even more context dependant, which I consider to be bad.

There is no reason for such awkward constructs as "::". The
syntactical structure of a Pascal case statement is much superior
to that of a C (or C++) switch statement. (The existence of fall
through is not part of that structure.)

It (C++) is really a development experiment, implemented with
macros, awaiting a real definition of reserved words, etc. Again,
IMO. Ratfor hid obfuscated Fortran constructs behind a
self-consistent language, while C++ operates in the opposite
direction.

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 14 '05 #620

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
9936
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
11137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10845
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10412
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7123
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
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.
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.