With C++ and C# out now, why do people still bother to program in C? It's old and there are newer, better languages out now. C is also difficult to deal with on really large programs.
Printable View
With C++ and C# out now, why do people still bother to program in C? It's old and there are newer, better languages out now. C is also difficult to deal with on really large programs.
>C is also difficult to deal with on really large programs.
What about small programs?
Because it can be fun, that's why I use it every now and then. Still, I prefer C++ and C# over it though.
Because there's still a LOT of software out there written in C, and I bet you if you have to work at a company that maintains old software, you'll be working a lot with C.
because some of us like to use the right tool for the job, and some people work on embedded systems... and it works fine for large programs... and its not C thats hard to deal with... its proper design.
i love C, its small and compact, minimalistic... lets you do what you want how you want. best language going.
Well.. if C's the best language.. why don't all people just use C++? If C code compiles on any C++ compiler..
thats just like my opinion man...
>If C code compiles on any C++ compiler..
it doesnt... try compiling C99 on a C++ compiler...
> If C code compiles on any C++ compiler..
Except there's a lot of perfectly valid C which either doesn't compile at all on a C++ compiler, or compiles but gives different answers.
// valid C, doesn't compile in C++
int class;
// different answers
printf( "%lu\n", (unsigned long)sizeof('a') );
Here's a list
http://david.tribble.com/text/cdiffs.htm
umm.. right.. so why don't people just forget C and start programming all on C++? if it's much better and has the same features as C does?
That's just an opinion though. I like C better than C++. That doesn't make C better than C++. Sometimes I like programming in python instead of C, but that doesn't make python any better. You can't really say any language is better than another. Like most people have already said, it depends on what you are trying to do that determines which tool is best for that situation.Quote:
Originally Posted by Ruski
And C is not dead just because there are new languages that have names that start with the letter C. A lot of programs are still programmed in C. Look at Gnome and some (if not most) of its programs are written in C.
isnt c++ object oriented?
c clearly isn't... natively anyways.
structs (I don't know what you mean by "natively")?Quote:
Originally Posted by B0bDole
Personally, it has nothing to do with features, and everything to do with availability and choices. In my universe, C++ compilers are rare. Good, reliable C++ compilers are even more rare. I'm not even talking about tools either, just compilers. BTW, I don't write desktop or web applications, and my programs are less than 20 source files on average.Quote:
Originally Posted by Ruski
I have a small, easily portable RTOS kernel written in C, and a wealth of code for common components that is all written in C. So, it might be better, but it isn't necessary for me to be productive.
Like I said, that's just me.
Wow, I don't even post here much any more and I can remember this topic being posted at least once a month years ago.
Honestly, what kind of responses did you expect to get here?
It's not that C is better or worse. You, as a programmer, should pick the right tool for the job. Do you hammer a nail with a screw driver? No. You could, but it wouldn't be fun.
But think of the entertainment value for the onlookers!Quote:
Do you hammer a nail with a screw driver? No. You could, but it wouldn't be fun.
IIRC there was an Object C that was OO. You can use ADT programming to simulate OO in C but true OO is not really viable in C.Quote:
Originally Posted by B0bDole
C, C++, Python, PHP, (but not C#) are all tools that were designed to run on any platform but have different uses. If you were writing a program for an embedded system that had a very small stack you had better be using C over C++. And you probably should be using Structured / Prodecural programming over OO programming. But thats because of the limitations of the environment. use the right tool and all will be well.
C++ compilers aren't rare.. Even in the place wher I live they aren't rare.. as long as you have access to the internet you can get any free compiler.. There was a list somewhere.. faq or maybe search.. Dev-C++ isn't a bad choice.. I use it myself.. Anything that I compile in visual C++ 6.0 and metrowerks codewarrior 8 can compile and run in dev c++ as long as I have the dlls :)Quote:
Originally Posted by whoie
> umm.. right.. so why don't people just forget C and start programming all on C++?
Because there are many more machines in the world other than the one sitting on your desk.
There are a whole range of embedded devices which do not have a C++ compiler at all - your only choice is 'C' or whatever obscure assembler that's available.
http://sdcc.sourceforge.net/
Check out the processor support for this C compiler, and see how far you get finding good C++ compilers for them.
Creating a C compiler is far easier than creating a C++ compiler. If your market is pretty small, the investment in time is harder to justify.
Even when there is a C++ compiler, all sorts of real time constraints (processor speed, memory occupancy, inter-process communication) mean that you can't just use C++ for everything. Even when it can be used, there are often guidelines to restrict it to "c++ lite" (basically a nice easy subset of C++).
Congratulations, you completely missed the point. :) And the point is that not everyone has the same setup as you, and there are a lot of systems that simply will not support a C++ compiler. Even those that do may not support a good C++ compiler.Quote:
Originally Posted by Ruski
Here's an example: the FAA will not certify anything for flight that is running code that was written in C++, as the flow of the program is inherently not as deterministic as the flow of a C program. C code, however, can be certified. There's a multi-billion dollar a year reason to use C.Quote:
Originally Posted by Ruski
Minor correction - C# does run on multiple platforms.Quote:
Originally Posted by Thantos
But it was hardly designed for it. Sure, the language itself is pretty platform-independent, but the design of the .Net library is inherently bound to Windows concepts. Just look at how much trouble the Mono project had with implementing Windows.Forms.Quote:
Originally Posted by stovellp
in C there isn't object construction/unwindding (no function calls). No variables auto initialized, no type checking (therefore more efficient altough less safer). But unfortunately no thiscall convention