Why do people still use C ?

Started by
121 comments, last by Oluseyi 19 years, 6 months ago
Quote:Original post by Pxtl
They're the one person who won't have memory leaks, threading access violations, deadlocks, buffer-overrun vulnerabilities, uninitialised pointers, undecipherable code, etc.


I am sorry, which of the above issues are corrected by C++? Ooops. Fundamentally flawed argument.

Quote:
You are not a special and unique snowflake, and I'm sick of dealing with your code.


That's nice. Have a cookie. I am sure that someone deliberately went out of their way to write ugly code to annoy you. It couldn't possibly have anything to do with writing extremely portable code. I personally think that the code in GNU's getopt.h & getopt.c is really ugly, but you know what kicks? The fact that I can seamlessly recompile it in C or C++ on FreeBSD, Linux, MacOS X, and Windows and not have to rewrite my code for handling command line parameters.

Quote:
C is for hardware interfacing, legacy, and personal projects that nobody else needs to use. Otherwise, do not use it. And using C++ but only calling C functions is not a solution - its just as bad.


C is a tool, just like C++, or Java, C#, or even Visual Basic. Each has a place where they provide a better solution; to believe otherwise is to willingly wrap yourself in a cloak of ignorance.

Quote:
C++ is an overcomplex kludge that converts C into an OOP language. But its also the fastest popular OOP language, so it wins.


Umm okay, it may execute the fastest, but in terms of development time? This is why I have been using Microsoft .NET and Mono.NET more and more lately [as satan chuckles in the background]. One of my co-workers who happens to be a kernel developer for FreeBSD is planning to implement an image loader for the .NET framework as a kernel option to optimize the performance of .NET on one of our web servers.

Oh, did I mention that he programs primarily in C? I guess it must be that he agrees in using the right tool for the job.

Quote:
C is like goto. Its an unsafe anachronism that should be left to the hardware nuts.


C is like a hammer. Its not subtle, and it gets the job done. If you don't hit the nail squarely on the head then you are bound to screw up the job. If you don't like it get a nail gun or hire a professional.
Advertisement
why does a dog lick his balls?

because he can.
Point is C++ is by no means flawless, and to try to redirect a noob into using C++ instead of C because it's somehow easier than C or manages memory better, is just dumb.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org
Quote:Original post by Pxtl
The point is that its easy to forget one little thing.

That's true... to a point.

With C, since the language easily lets you screw yourself, you have to be disciplined. (how many times have I said this now? am I starting to sound like W debating?)

People learn languages easily enough, and with some languages you can get by with only learning them. With C you have to learn the language AND the best practices, otherwise you end up with shitty code like you state.

But once you know both, buffer overflows disappear in secure library functions, and memory management becomes automatic because you DON'T forget to free something.

If you're writing C code and it's hard to keep track of memory management, you're not writing it correctly. A memory leak is not a sign of a bug, it is a sign of a stupid programmer or a bad design.

C still has appeal because there ARE programmers that know C, and know how to write C, and are good at designing C code.

Anyway, this isn't a thread about whether or not you think C sucks, it's about why C is still used. I think that's been answered.
Quote:Original post by Codemonger
Point is C++ is by no means flawless, and to try to redirect a noob into using C++ instead of C because it's somehow easier than C or manages memory better, is just dumb.
Well, they should really be directed away from both.

C++ is just too complicated, and C requires discipline (again! ug!) that would need to be taught simultaneously.

That makes both hard to teach.
some people just enojy one language more than another, i prefer C++ having seen some of it's advantages for my own field, but there's tonnes of scope for using straight C, the GameBoy Advance used C last time i looked, and most embedded programs are written in C or ASM.

C is a great language to learn from as well, as long as you're not taught bad habits! But for PC development i eventually saw the light after almost 9 years of C and switched to C++ once a tutor had actually managed to convey the concepts that actually made sense to my own situation.

Never dislike a language just because it's been around a while. That language will have a place and purpose, use that language where it's suitable. Use another where it is not AS suitable.

I like C personally, it's one of the first languages i learn't and i still have to use it on a regular basis.

Andy

"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile"

"Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."

Quote:Original post by C-Junkie
Quote:Original post by Codemonger
Point is C++ is by no means flawless, and to try to redirect a noob into using C++ instead of C because it's somehow easier than C or manages memory better, is just dumb.
Well, they should really be directed away from both.

C++ is just too complicated, and C requires discipline (again! ug!) that would need to be taught simultaneously.

That makes both hard to teach.


i think that the problem is: Anyone can be a bad programmer, regardless of language.

C or C++, neither one is better, it depends on the teacher and who is being taught. C++ is not that complicated, some of the OO paradigms can be a pain, but thats just the language used rather than the concepts, and C doesn't require discipline, but doing anything well DOES.

No this kind of argument makes no sense, use a damned hammer for a nail and a screwdiver for a screw.

C is beautiful in it's place C++ is hell out of it and vice-versa[grin]

Andy

"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile"

"Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."

Here's my thoughts on the matter... you're free to ignore me if you like... Ok... why do people still use C? Well, because C++ standard was accepted in 1998 (1997?), and yet there are still no 100% compliant compilers. It's rather frustrating and you think that someone would have developed one by now... Yes, some compilers are getting very close, but they still haven't hit that mark. ANSI C has been around for a LOT longer and is much easier to _depend_ on the compiler being 100% compatible, and hence, greater portability.

With that being said.. my current project is being written in C++, so don't get me wrong. :-)
You might as well ask "Why are people still coding in FORTRAN and COBOL?" The answers are similar.

However, the distinctions that people make between C and C++ is strange. C and C++ are not different languages. Except for a couple of minor instances, C is a subset of C++ and the same compilers and linkers are used. Thus, people that "program in C" are actually programming in C++, and simply not using certain parts of the language (and libraries). Same goes for discussing which is better.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Quote:Original post by JohnBolton
C is a subset of C++

Calling C++ a superset of C would be more descriptive IMHO... but maybe I'm just crazy.

As others have mentioned, C++ and C are powerful, but easily misused. Someone mentioned liking C better - I prefer C++ (and repeatedly bash my head against a wall when stuck with only a C compiler - I really hate not having my OO tools in place) but at the same time prefer C libraries, because:

1) Many C++ libraries out there are poorly designed (personal opinion, not flamebait)
2) Many C++ libraries are designed with a different interface or use in mind, making them harder to adapt to your planned class structure
3) C code is usually (usually) decently easy to wrap yourself, resulting in classes that follow your project's naming conventions, melds nicely with whatever object scheme you're working with, and usually has been around long enough to get a lot of bugs ironed out.

My 2 cents.

This topic is closed to new replies.

Advertisement