473,889 Members | 1,322 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 23922
Chris Hills <ch***@phaedsys .org> wrote in message news:<cl******* *********@pleth ora.net>...

Being power hungry is not the reason why an 8051 does not (normally) run
at 2Ghz.... Many 8051's work in areas where power is not a factor. They
run code from 2Kbytes to 16Mega bytes.

Yes, the usual reasons for slower clock speeds are (in my business):
- Slower rated chips are cheaper
- You don't usually need that speed
- Heat dissipation becomes a problem at high speeds
There are also many 32 and 64 bit embedded systems running that have
megabytes of code.... virtually any car radio or engine management
system. I did have the figures for the line of code in a car radio. It
was in the 100's of thousand lines! It surprised me. Engine management
systems have the odd megabyte of code.


and when things are programmed in assembler, an 8K processor can still
hold 6-8 KLOC!.

Keith Derrick (ACCU member)
PS Don't bother sending mail to my posting address, it's a spam trap.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et
Nov 13 '05 #241
j

"Fergus Henderson" <fj*@cs.mu.oz.a u> wrote in message
news:cl******** ********@pletho ra.net...
Jerry Feldman <ga********@blu .org> writes:
Keith Thompson <ks*@cts.com> wrote:
C++ has never been a strict superset of any version of C. C++ has
several keywords that are not reserved in C; that alone makes prevents
it from being a superset.
I agree that "C++ has never been a strict superset of any version of C",
but I disagree with your logic. A superset can define new keywords (and
comment operators).


A strict superset can't, if those keywords have names which are not
already reserved for use by the implementation, because adding new
keywords will invalidate existing C programs that happen to use those
keywords as identifiers.


I don't know why people mold terms to fit things how they would like to see
them.
C++ is not a superset, period. ``strict superset'' throw it out of the
window.
When something is a ``superset'' of something else, that something else is
considered to be a ``subset''.
Now inorder for C to be a subset of C++, you would be able to compile _any_
C program with a C++ compiler. This can't be done, because C is not a subset
of C++, and that is because C++ is not a superset of C. It is a
``derivative'' of C. Nothing more and nothing less.
Adding new comment operators can also change the meaning of existing code.
Consider the following program:

int main() {
printf(1//**/2
? "fail\n" : "pass\n");
return 0;
}

On a conforming C89 implementation, this will print "pass",
but on a C++ or C99 implementation, it will print "fail".
However there are many constructs in standard C that
are illegal in C++. One example that comes to mine is:
In C:
void foo(void);
In C++ this will cause a syntax error because C++ requires fully
prototyped functions.
That's not correct either. C++ allows "void foo(void);".

--
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 #242
On Mon, 13 Oct 2003 22:18:56 +0200 in comp.std.c, Alexander
Terekhov <te******@web.d e> wrote:

th*@cs.ucr.e du wrote:
[...]
C is pretty much, but not quite, a sublanguage of C++. C programmers
who don't use the non-C++ features of C are programming in C++ whether
they claim to or not. They are restricting themselves to an older,
more established, more easily learned, and more easily implemented
subset of C++. But they are writing in C++ --- non-idiomatic C++, but
C++ nevertheless. AFAIK, a C++ compile is free to generate the same
code for those programs as would a C compiler, so there is no
intrinsic difference in performance.


In C without exceptions (stuff like MS or DEC/HP SEH extensions), all
functions are kinda "throw()".


I take exception to the object of that last block! ;^>
In idiomatic C, each function is like a try block, each return is
like a throw, and each call is like a catch.

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
Nov 13 '05 #243
On Wed, 15 Oct 2003 00:21:21 +0200 in comp.std.c, "cody"
<do************ *********@gmx.d e> wrote:
The type of 'a' is int. The C99 standard, section 6.4.4.4 paragraph 2,
says:

An integer character constant is a sequence of one or more
multibyte characters enclosed in single-quotes, as in 'x'.

Was is the same in other versions of C besides C99?


As far back as K&R1 -- common C idiom was 'ab' (16 bit) or 'abcd'
(32 bit) to handle packed chars -- undefined behaviour as of C89
-- but still allowed and works?

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
Nov 13 '05 #244
Arthur J. O'Dwyer wrote:

[C89/C99/C++ tests]
Now, what silly mistakes have I made *this* time? :-)


Failure to use the standard macros? ;-)

#include "stdio.h"
int main(void)
{
int
#ifdef __cplusplus
i = 2;
#elif defined __STDC_VERSION_ _ && __STDC_VERSION_ _ == 199901L
i = 1;
#else
i = 0;
#endif
puts(i == 2 ? "C++" : i == 1 ? "C99" : "C89");
return 0;
}

Jirka

Nov 13 '05 #245
Jirka Klaue wrote:
#include "stdio.h"
int main(void)
{
int
#ifdef __cplusplus
i = 2;
#elif defined __STDC_VERSION_ _ && __STDC_VERSION_ _ == 199901L
i = 1;
#else
i = 0;
#endif
puts(i == 2 ? "C++" : i == 1 ? "C99" : "C89");
return 0;
}


A C89 implementation is allowed to define a __cplusplus macro, AFAICT.
(You also classify C0X as C89).

Jeremy.
Nov 13 '05 #246
On Wed, 15 Oct 2003 23:42:23 +0000 (UTC), Richard Heathfield
<do******@addre ss.co.uk.invali d> wrote:
cody wrote: [...]
This seems to be true for both C and C++ compilers (I tried both).


It really is time to stop guessing at this stuff. The C language is defined
by an international standard, not by your apparently random guesses.


"It works on my compiler" is never a good argument in c.s.c.

Regards,

-=Dave
--
Change is inevitable, progress is not.
Nov 13 '05 #247
"Mark Gordon" <sp******@fla sh-gordon.me.uk> schrieb im Newsbeitrag
news:2003101523 2209.128f9a60.s p******@flash-gordon.me.uk...
On Wed, 15 Oct 2003 22:17:35 +0200
"cody" <do************ *********@gmx.d e> wrote:

Please don't trim the attributions since it prevents people from seeing
who said what.
int test(int size)
{
int *new = malloc(size); /* two non-C++isms in this line */
return 1 //*
-1 + 1; /* 0 in C99, 1 in C++ */
}


is the missing semicolon at the end of a block allowed in C?


A semicolon is required to terminate every C statement, however in C99
there is no missing semicolon in the above.

HINT: C99 added a form of // commenting.

int test(int size)
{
int *new = malloc(size); /* two non-C++isms in this line */

return 1 //* <-- the c version misses a semicolon here,
additionally //* will imho produce no valid comment in c.

-1 + 1; /* 0 in C99, 1 in C++ */
}

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #248
> > int i = sizeof (int);
// int j = sizeof int; // invalid in both C and C++
int k = sizeof i;
int l = sizeof (i);

The form of sizeof that gets a type as parameter has to use parantheses,
while the sizeof that gets non-expressions as parameter do not need
them.
Wrong. In your example, i is an unary-expression, not a non-expression.


I don't know why i wrote non-expression. My example clearly showed how to
use sizeof:

The form of sizeof that gets a type (NON-EXPRESSION) as parameter has to use
parantheses,
while the sizeof that gets expressions (NON-TYPES) as parameter do not need
them.

Is it now correctly stated?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #249
"Richard Heathfield" <do******@addre ss.co.uk.invali d> schrieb im Newsbeitrag
news:bm******** **@titan.btinte rnet.com...
Douglas A. Gwyn wrote:
cody wrote:
The problem is that i believe that my assertions are correct.


Yes, that is a problem.


I hope the sig-monsters are awake.

What is a sig-monster?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #250

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
9961
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
10789
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
10441
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
9606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7150
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
5828
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
6028
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4647
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
3
3255
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.