Jump to content
  • Advertisement
Sign in to follow this  
massive-war

What am I un-aware of?

This topic is 4735 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

I started with c++ as my first language, so I really don't know of anything any other way. So many people talk about how c++ is a waste of time and how things can be done much quicker in other languages. Is there any way someone can enlighten me on this? Thanks, Massive-war

Share this post


Link to post
Share on other sites
Advertisement
In C++, you have to make sure that you don't overwrite the end of arrays, that you don't use pointers after you've deleted what they point at, and that you actually remember to delete what you've allocated when you're no longer done with it. If you do something wrong, you may crash at that point in your program -- or you may crash in some other, seemlingly unrelated point, sometime later during execution. Debugging these kinds of errors can be hard.

In some other languages (like Python, C#, Java, etc), those things are taken care of for you; if you have an error, it'll immediately be caught and shown to you, and garbage collection will make sure you never have a stale pointer or memory leak (although you may still have an unintentionally growing store). The draw-back is that the execution speed of those languates is generally somewhat slower than a C++ program written by a team of experts.

Share this post


Link to post
Share on other sites
Im in agreement with hplus.

In c++, you have to worry about a lot more things, but because of that, you have a lot more control over how things are run.

People use c++ for many reasons:
-they have always done so. C++'s predecessor c was vastly popular just because, and so is c++.
-c++ gives you almost 100% total control over memory, execution, etc., just like assembly would, but its "better" for humans to read.
-"pure c++", that is, c++ without api's, isnt platform specific, so knowing c++ allows one to program for many platforms.

Share this post


Link to post
Share on other sites
Quote:
Original post by massive-war
So why do people use c++ then? Granted, it's fast, but would it be worth the effort in game development?

Massive-war


C++ is good for some things, but it is not (in my opinion) the best for most of the things people use it for. I would guess that the main reason that people use it a lot is that it's popular and they think that must mean it's good. Or maybe because that's the language they know and they don't want to take the time to learn another one.

Share this post


Link to post
Share on other sites
Some of these points are not quite as big a problem anymore. At least the express version of the latest VC++ does a lot of runtime checks in debug builds. Of course that doesn't help much if you never run into any problems during testing, because the bad code is in some rarely called place. But the idea of having the same checks like Java and co. for debugging while still being allowed to turn them off seems like a good compromise.

Share this post


Link to post
Share on other sites
using C++ is like driving a stick shift.
C#, Java are like automatic.
:-)

If your main goal is to get to the destination, you would prefer to use the fastest/safest vehicle... Many people who like to ship products (and make money in the process) hate C++. Bad programming/understanding of C++ can lead to hours of time wasted tracking and fixing bugs which could have been saved by using C# or Java or whatever...

Some people just drive stick shifts for the fun of it. Some people use C++ for the same reason.

Share this post


Link to post
Share on other sites
People learn C++ because for most coding JOBS it is still the standard. Or because most people use it (and so most tutorials and articles assume C++ knowledge).

You might like to just get a book or something on C# which you'll find pretty similar to C++ but with some useful additions as others have already said. It's getting more and more widely used in the (no-game) industry, and also lots of people on these forums are starting to use it so you'll still get lots of useful advice!

Share this post


Link to post
Share on other sites
Every language has its balance. If you want the best performance, learn assembly, but it will take the longest to develop. If you want to throw it together quickly, learn DarkBasic, but it will perform the slowest. In between, there's a whole myriad of languages, but each has its vices and virtues.

It seems that C++ may be going the way of assembly (not yet, but coming soon). It's just too much work to get the end result. I've programmed in C++ for years and have most of the functionality I need implemented, therefore, I'm comfortable with C++. On the other hand, starting out, it seems a bit much to be bothered with. If I were starting out right now, I'd probably go with C#.

Share this post


Link to post
Share on other sites
Personally, C++ wouldn't be the best language to learn programming with except for the wealth of referance materials. As an example, at least to me, Pascal is easier to read. What I like with C++, or really C in general, is that it is compact without being cryptically so, i.e. APL. It is a very simply language in that knowing every keyword and operator doesn't require much memorization while still being quite powerful and flexible. So it's a good distillation of the elements of application logic.

I think it is generally a good idea to do a survey of languages. Visual Basic since it is the macro language for MS Office and virtually every other Microsoft product. Python and LUA because of their widespread use as scripting languages. Java because of it's widespread use in web pages. SQL because it is simply so handy for data analysis such a making sense of performance data. Perhaps a bit of assembler so you understand what the compiler does for you and so you can look at the generated code to understand why a statement didn't do what you thought it should.

You'll find in your career that you need to use many proprietary languages for differant packages. Once you learn the basics of 10-12 languages and how to use a couple fairly well then yet another is no biggie. I've easily used over 100 languages over the years. Physician heal thyself? Programmer automate thyself! I program because I'm lazy and I will go to great lengths to get the computer to do mundane, repetitive and boring tasks for me. So any and all means to automate anything that I really don't want to do.

As far as what more should you know? The Standard Template Langauge (STL). Know the language? Good for you, but know the library that comes standard with it as well. You might as well learn MFC as well. It's a good way to learn how to use classes effectively in a program. Pariticularly since how to do everything it does without it is well documented, i.e. use Windows facilities. Learn how to use libraries and DLL's to reuse your code. Learn your IDE to full effect as well. With many applications it is often the shear weight of the functionality in total and not the complexity of individual functions that is the challenge, i.e. the 100k lines of code. The organization of the code and automation of the actual coding process becomes critical to getting done in a timely manner.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!