Do you have to know anymore coding languages than C++?
Printable View
Do you have to know anymore coding languages than C++?
"have to" - possibly not.
"useful to" - possibly yes.
Compare a carpenter who only knows how to use a hammer, compared to one who knows about hammers, chisels, saws, planes etc.
Mastery of one or two is a must, being familiar enough "to get by with the help of a manual" for several others.
Okay, thanks.
What would be another good language to learn?
How about starting with C++? Are you quite familiar with C++?
For another language, I might suggest C, Perl, or Python. It really depends on what you want to do.
"Write video games!"
With Perl or Python you'll probably be able to create programs more easily and with less code, but the performance of the code in the end probably won't be as good as it could be . . . .
Well I've just started with C++ but once I get farther I'll probably start doing C.
Thanks for the info though. :)
If you've just started, don't try to learn too many languages at once. You'll just confuse yourself. :)
Really. You'll accidentally type cout in a C program or something like that.
[edit] Note my previous edit. I decided it would be best to recommend Perl or Python instead of C . . . C is good too, however, and very widely used. [/edit]
I would avoid C for anything that does not require it. The reason is that C is a very low-level language and a lot can go wrong. Plus you can use low-level C++ where low level is required, which is still safer than pure C (although I'm sure many would disagree here).
Further, well written C++ is as fast or almost as fast as pure C.
In today's place with big, complex games and security concerns, using C will be like shooting yourself in the foot.
There are times and places for everything, but I don't think I would like to call games one of them (for C).
C++ can do 99.9% of what you can do in C, so I agree with. I don't agree that C++ is in any way safer than C - they both have the same basic concepts, and the perceived safety of C++ comes from well-defined additional libraries, which can be done in C as well. Both languages have great big holes allowing a programmer to make mistakes that can crash the system - C++ has nothing to prevent you from doing
Code:
int *p = (int *)12345;
*p = 7;
Indeed - because, if the C solution is faster than the C++ solution, you can simply use th same solution in C++, and the compiler will generate the same code [assuming we don't change compilers - different compilers will do vary as to how good code they generate for a particular piece of source].Quote:
Further, well written C++ is as fast or almost as fast as pure C.
--
Mats
This is true, but C++ offers a great variety of tools and features that allows you to more safely write programs that are safe.
Smart pointers kills most access violations there are (and we have std::tr1::shared_ptr, std::auto_ptr, std::tr1::weak_ptr to help us here).
Bounds checking, encapsulated in a class, destroys most if not all out-of-bounds array access, and so on (we even have std::vector and std::tr1::array to do this for us).
But all of those examples are simply encapsulating good code, not parts of the language definition itself, and that is my boon with your constant repetition that C++ is safer than C - it is not the language itself that is safer. There are safe libraries for many things in C as well.
--
Mats
Perhaps it stands as a matter of definition, but if you ask me, C++ is safer than C. The fact that it is much stronger typed is enough for me to call it safer.
And the fact that you don't have to hunt for safe libraries (because they're standard!) makes C++ safer in my eyes.
And don't forget that it's somewhat impractical (due to much code duplication) for safe code or safe libraries in C, whereas in C++, there's much less need for such things.
It's all in how you see it.
In my view C++ can be just as dangerous as C. Any tool in the hands of an idiot is a dangerous thing. When choosing which to use I don't consider basic memory management principles that every programmer should know as criteria in the decision.
Indeed - and if you don't want to worry about memory management and such details, then there are languages such as Java, Perl and Python that "does this for you". Those are excellent learning languages, but once it comes to high-performance production code, C and C++ beats them in most cases.
--
Mats
It could also be discussed as a matter of "semantics" or whatever you want to call it.
If you use C code in C++, then by all means, it pretty much is C and not C++.
If you use the standard library, classes, templates and stuff, then it's pretty much C++. The "safe" part of the language.
Anyway, safe or not, it doesn't change the fact that C isn't really made for big projects and code reuse and such. It's very much low level.
IMHO, a little bit of assembly is needed. At least for performance optimization. Also a scripting language like Lua would come in handy sometimes.