Any reason to use C?

Started by
17 comments, last by Russell 20 years, 8 months ago
Is there any reason to use C instead of C++ anymore? I am asking in regards to starting new things, not maintaining old code.
Advertisement
If you don''t know why you would want to use C, you don''t need to use C. It is, however, useful to know.

How appropriate. You fight like a cow.
It depend on what you want to program. The gba programming is mainly C, because the code is lighter. It all depend of what you want to do, and of your preference.

~-~-~-~-~-~-~-~-~
Butterfly Corp
I can think of reasons why someone might want to. Maybe they like to be able to actually read the assembly source code generated by the compiler. C++ mangles names due to function overloading, or some such.

I''m not looking for answers for myself personally. I would like to know what reasons people might like to use C instead of C++ nowadays. So rather than saying, "if you don''t know don''t worry about it", I''d like to know what YOU think.
Embedded systems programming is a biggie, as is low-level operating system programming. Also, when making a library that may be used by people using C (for whatever reason), it''s often a good idea to write it in C.

How appropriate. You fight like a cow.
One could also write the library in C++ with the functions exposed using C linkage.. :-)

No seriously its just personal preference. C is a cleaner language with fewer constructs than C++ and has a certain beauty to it. Also a serious concern with C++ is that though it has a standard compiler makers are not that great in implementing it to the letter.

This might not seem like a big issue but when you have a multiplatform game with 100 000 lines of code and twelve programmers those subtle differences become increasingly more of a pain to handle. And you bet they pop up before the milestone build, personal experience talking here!!

But, for one or two persons working on a hobby/freeware/shareware game those resons are not an issue. Use the language you''re most comfortable with. I would suggest C++ but thats just _my_ preference.

Unless youre on a gba... c++ on a gba is totally overkill in my humble opinion.

Per Dervall
Programmer
Warthog Sweden
[Insert cool signature here]
Is there really anything to be said for C being a "cleaner" language? Is that really an advantage? Sounds kind of like a "fake advantage" to me
quote:
One could also write the library in C++ with the functions exposed using C linkage.. :-)


exactly what I''m doing to link OCaml to a Direct3D engine hehe.

I tend to think of C as cleaner, but for a large project C++ has more nice constructs for segregating implementation and interface. Although C++ is supported on most platforms anyway, I still (it''s mostly an illusion I know) see C as being more portable.
quote:Original post by JuNC
quote:
One could also write the library in C++ with the functions exposed using C linkage.. :-)


exactly what I''m doing to link OCaml to a Direct3D engine hehe.


O''Caml???!?!?!?! Please, tell me you''re joking...

But why would you want to learn C? Well, if you''d like to become an anachronism... j/k. Good for low level stuff, OS''s, etc. Not cleaner than C++ if you know what you''re doing. But you have to do a few more things, like putting the word "struct" whenever you use a struct variable in your program, etc. C++ cleaned a lot of that kind of stuff up.

-Nick
quote:Original post by nickwinters O''Caml???!?!?!?! Please, tell me you''re joking...
I remember when I was young and stupid. I laughed at anyone who said they used LISP. How foolish I was...

So, what''s wrong with OCaml? Have you ever used it for anything significant? It is as about as fast, or faster, than C or C++ for quite a lot of things.

In general, functional languages are about as fast as C/C++ nowadays, and they make a lot of things easier on the programmer.

This topic is closed to new replies.

Advertisement