So C++ is an upgrade from C, that has been accepted by so many, and still people say C is better? o.O ...
I'm not getting it, one bit :P
Printable View
So C++ is an upgrade from C, that has been accepted by so many, and still people say C is better? o.O ...
I'm not getting it, one bit :P
> And yet so many a great a things are designed for C, still. Utter foolishness.
I'd say it's foolish to use C++ for an API or library. Well depending strictly on the case of course...
1) Most libraries don't need a OO design
2) You can easily write a wrapper to make it OO
3) Ensures that people with C and C++ can use it
If however you write it in C++, then you've chopped off the people who want/need to use C.
C++ was designed to accept C source code as valid compiler input. It's not strictly an "upgrade", rather it was designed like that to make for an easier transition by the uncouth hordes of C programmers left over from the Hippy era of programming :D
Neither C nor C++ is "better" overall, it's just what you're used to and what programming model you prefer, as well as the specific purpose you have in mind.
Procedural C code can in theory compile to faster executables compared to Object Oriented C++ code because of the higher overhead involved with things like virtual functions, but in practice this difference is often negligable because it's easier to write efficient C++ code as compared to efficient C code.
Thus 2 programmers with comparable levels of expertise will probably produce roughly equally efficient code, one writing C and the other C++.
The C++ code however will be (in general) easier to maintain and expand/reuse than the equivalent C code (again, from a specific level of expertise on the part of the authors and given comparable levels between the authors), making it a better choice to use in a commercial environment.
Yes, I'm not talking about embedded stuff. I'm referring to typical PC stuff.
Then they have chosen a poor language and the wrong tool for the job, if it is not demanded by the platform they work for.Quote:
If however you write it in C++, then you've chopped off the people who want/need to use C.
Which creates an evil cycle. Programmers use C, thus they need libraries written in C. As demand increases, more libraries are written in C, leaving C++ programmers in the cold, merely because C++ is backwards compatible.
And, of course, since there are more C libraries, there becomes more C programmers. And so the cycle begins again.
Today is a modern world where C really should have no place, especially in PC software.
1) Nothing says it does not. Besides that, C++ has more features than merely classes, although it is of great boon.Quote:
1) Most libraries don't need a OO design
2) You can easily write a wrapper to make it OO
3) Ensures that people with C and C++ can use it
2) ...Which instead could have been written into the library in the first place. Thin wrappers and not necessarily better than its C counterpart.
3) Brings me back to the point about C above...
SDL is not hard at all, even for beginners, if you start learning it, you'll realize how easy it is.
I recommend to look at this sites, because they have very good tutorials about SDL for beginners.
http://lazyfoo.net
http://www.sdltutorials.com
SDL is not hard at all, even for beginners, if you start learning it, you'll realize how easy it is.
I recommend to look at this sites, because they have very good tutorials about SDL for beginners.
http://lazyfoo.net
http://www.sdltutorials.com