Archived

This topic is now archived and is closed to further replies.

Enselic

C is unnecessary

Recommended Posts

I''m not sure weather this discussion has been taken, in that case I''ll immediatly delete this thread. Anyway, I find this discussion of unlimited interest.
My statement:
There is absolutley NO reason to code in C anymore since we have C++.
Please present any arguments against my statement without a flame-influence. ____________________ ____ ___ __ _ Enselic''s Corner - CodeSampler.com

Share this post


Link to post
Share on other sites
there will always be a reason to code in C..
people still code in COBOL and Fortran. its also a maintenance issue- there are several million pieces of software coded in C already...

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
C is simpler than C++. Well written C++ code has a great deal more of complicated language constructs compared to well written C. Not everyone has the time to learn these features, so it may be more efficient just to get the job done in C than for everyone to learn all C++ aspects.

Just take a look at some of the Boost''s more complicated libraries. You may not have a slightest idea of what''s going on there, since they abuse so many of C++''s features. But if something vaguely similar was written in C, it''d be done with the relatively "few" constructs C has and you could at least start trying to comprehend it.

One could say that "just use a couple of C++ features, those that are handy" and treat the Boost libraries like black boxes that do something neat. But where to stop? Are templates too complex? Template metaprogramming probably is. How about making proper use of classes? Assume everyone has read Design Patterns? Should const correctness be used or is it more trouble than it''s worth? The list goes on.

C++ definitely has a hefty deal of more expressive power than C, but you have to take other kinds of practical values into consideration too.

Share this post


Link to post
Share on other sites
quote:
Original post by Enselic
Diffrent languages serve different purposes. But since C is not diffrent from C++ since C++ is extended C, C could be thrown into the paper-basket.


Then why don''t then just do so and be happy?

Share this post


Link to post
Share on other sites
There noone saying that just because you have a neat load of features, you shall use it. If someone say "C++ is too complicated, learn C instead" they havn''t really though. You can study the complicated parts of the language later on.


____________________ ____ ___ __ _
Enselic''s Corner - CodeSampler.com

Share this post


Link to post
Share on other sites
quote:
Original post by Enselic
There noone saying that just because you have a neat load of features, you shall use it. If someone say "C++ is too complicated, learn C instead" they havn''t really though. You can study the complicated parts of the language later on.
Not everyone is writing code alone, you know. When working in a team environment, you can''t just "learn as you go" and "write as advanced C++ as you can".

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There is absolutley NO reason to use new language (C++) because we have a good language (C) that can be used for almost all.

Enselic, why you don''t code in java or C# ? there are "better" than C++, the same occur with C.

I love plain C and not the superficial extension called C++

Share this post


Link to post
Share on other sites
C doesn''t support classes which is not good. You should at least have the opportunity.
Java and C# isn''t as free as C++. No language is better than the other. There''s just advantages and disadvantages.



____________________ ____ ___ __ _
Enselic''s Corner - My site. Go test my game Spatra and see if you can beat it onto the Official Spatra Top 10.
CodeSampler.com - Great site with source for specific tasks in DirectX and OpenGL.

Share this post


Link to post
Share on other sites
quote:
Original post by Enselic
Java and C# isn't as free as C++.
Can you explain this please? I can understand C# isn't as free as C++, but how is Java less free than C++ ?

Anyway, a few more arguments:
1) There are some devices for which C++ compilers do not exist, and C must be used.
2) C is more portable. In general, if you follow the C standard, then you can put your code through any modern C compiler, and it will compile and do what you expect it to do. But C++ compilers have a lot more variation, so even if you completely follow the C++ standard, you end up with code which doesn't compile in some compilers, or worse, compiles differently on two compilers.
3) Some people prefer C. You might not like it, but it's true.

John B

[edited by - JohnBSmall on May 3, 2003 10:58:22 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by JohnBSmall
I can understand C# isn''t as free as C++


I can''t.



"To assert that the earth revolves around the sun is as erroneous as to claim that Jesus was not born of a virgin."
-- Cardinal Bellarmine

Share this post


Link to post
Share on other sites
By free I didn''t mean anything economic. I meant "you can do more lowlevel stuff".


____________________ ____ ___ __ _
Enselic''s Corner - My site. Go test my game Spatra and see if you can beat it onto the Official Spatra Top 10.
CodeSampler.com - Great site with source for specific tasks in DirectX and OpenGL.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Enselic
No language is better than the other. There''s just advantages and disadvantages.

you just argued against your original statement.

if you have no concrete facts on the matter then it''s just your opinion. and everyone has one of those.

C does support classes in the same manner that it supports anything else that you''d want to do: using structs, functions, pointers, etc.

i was writing class based C code back in the ''80s. just because i didn''t have a couple of colons in my function names did not make them any less class driven.

the first C++ "compilers" were nothing more than pre-compilers that spit out C and then ran that code through a C compiler.

Share this post


Link to post
Share on other sites
quote:
Original post by JohnBSmall
I can understand C# isn't as free as C++
Original post by Arild Fines
I can't.
Well, ok, I wasn't aware there was a free C# compiler/interpreter, obviously I was mistaken.

John B

[edited by - JohnBSmall on May 3, 2003 11:08:09 AM]

Share this post


Link to post
Share on other sites
Enselic, why do you necessarily need classes? You have basically the same thing in C, just C++ is more idiot-proof:

  
// C way of doing things

struct foobar
{
int a;
char b;
float c;
};

int foo_bar(struct foobar x);
int fobar(struct foobar x);
int fooobar(struct foobar x);

// C++ way of doing things

class foobar
{
public:
int a;
char b;
float c;

int foo_bar();
int fobar();
int fooobar();
};

I don''t see too much difference here, only how the data is arranged. You might say, "But foobar->foobar() is easier to read than foobar(foobar)". Is it? Some people feel that the C way is better, because it automatically seperates data from functions, without factories.

If it helps, NWN and Quake ]|[ were written entirely in C.

Share this post


Link to post
Share on other sites
There is also a lot of controversy out there on whether OOP is really better. Sure, you may think it is, but the main problems are that it is much harder to design OOP applications. You might want to Google it.

Share this post


Link to post
Share on other sites
quote:

you just argued against your original statement.


Well, C and C++ aren''t actually two diffrent languages. C++ is extended C (thereby the name)

quote:

C does support classes in the same manner that it supports anything else that you''d want to do: using structs, functions, pointers, etc.


Might be, but if you are going to code OO-programs you make a fool of yourself if you choose C.


____________________ ____ ___ __ _
Enselic''s Corner - My site. Go test my game Spatra and see if you can beat it onto the Official Spatra Top 10.
CodeSampler.com - Great site with source for specific tasks in DirectX and OpenGL.

Share this post


Link to post
Share on other sites
As for how you said that C++ contains C, programming in C in C++ doesn''t mean you''re programming in C. If that were true, than I''m sure that a lot of people, including you and me, would really be programming in C instead of C++.

Share this post


Link to post
Share on other sites
quote:
Original post by Enselic
By free I didn''t mean anything economic. I meant "you can do more lowlevel stuff".

Well, thanks for clearing that up.

However, I think the Anon Poster has a good point - if "No language is better than the other. There''s just advantages and disadvantages." then how is C++ definitively better than C?

John B

Share this post


Link to post
Share on other sites