Jump to content
  • Advertisement

Archived

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

Russell

Any reason to use C?

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any reason to use C instead of C++ anymore? I am asking in regards to starting new things, not maintaining old code.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!