Quote:Original post by tibi
Thinks I like about C/C++:
- great IDE VC 6/7 (win), KDevelop (lin)
- easy debuging
- very good help (MSDN)
- easy integration (libs[fmod, gui, maya, ...])
- multiplaform (Win/Lin/Mac/Unix)
- full control of memory
- fast and can use CPU specific futures
- that code you make now can be good for a cople of years
- standart api
I don't know about Python, but it's ironic that most of these things are done better by Java and C#:
- Great IDE:
After using Eclipse, Visual Studio seems primitive. Eclipse offers:
- Refactoring: for example, rename a variable, method or class, and all references to it with a 3 keystrokes. Or, select a bunch of statements and automatically Extract Method from them (replaces sequences of similar statements with the method call).
- Incremental compile: finds and highlights syntax and semantic errors as you type; you'll never have to press Build, wait for it, and then go through 20 errors - if there are no errors marked, you can just save and instantly run the program.
- Code generation tools: generate getters and setters, create constructor from fields, create stubs for unimplemented abstract methods, etc.
- "Local History" automatically stores diffs of each file from the past X versions; you can compare and replace a whole class or just one particular method with a previous version from local history with a couple of clicks.
The only thing that I miss from Visual Studio is the form editor, but how many forms will you make for each project? And anyway there is a free plugin in development for that, it's just a bit slow and buggy right now. I think Visual Studio 2005 will add in some of these features, but even then, a C++ IDE can't give you as much help as a Java IDE because C++ is a more complicated language. In C++ you have #includes that simply paste in a file's contents, macros that can change the meaning of a common piece of syntax, #ifdefs, etc. It's a lot harder for the IDE to parse this in real time and give you meaningful information. It's nigh-on impossible to have it compile-as-you-type.
- Easy debugging: Same thing is true with Eclipse, or with Visual C#. Debugging managed code that runs in a VM is probably easier because there are fewer unexpected things it can do.
- Very good help: Java API reference for Java, or MSDN for C#.
- Easy integration/libs: Sure.. In C++, every library seems to declare its own type of int, float, and string, and sometimes even writing code to convert from one data type to another is time-consuming. Furthermore, you must link all these libraries into your project. In constrast, the Java standard library provides GUIs, regular expressions, image I/O (including JPEG, PNG, GIF), GZIP or ZIP compression, easy to use networking, XML, database access, and many other useful API's, all very tightly integrated, well designed, regularly updated (since they come with the JVM), and easy to use. If you want to use an external library, it's easy to add a JAR file to your classpath or just drop it in the /lib/ext folder of the JRE.
- Multiplatform: C++ is only multiplatform in that there are compilers for it on different platforms, and there are libraries which have been ported to all these platforms. Almost any programming language is "multiplatform" in this way. With C# or Java or Python, you just copy a file from one computer to the other and it works. Furthermore, C# and Java declare sizes and signedness for their primitive data types (int, etc), as well as other behaviour such as the meaning of "i += i++", whereas in C++ there are many things left "unspecified" by the standard, and you must write code defensively to deal with this.
- Fast and can use CPU specific futures
It's true that C++ lets you do a lot by adding assembly code, but with Java, you can run an old program on a new Java Virtual Machine and take advantage of CPU instrictions that weren't even around when the program was written. How often this will really be useful is a different question though.
- That code you make now can be good for a cople of years
In Java, the code you make now will likely work better in a couple of years because of bug fixes in the standard library, updates to the JVM, etc.
- Standard API
The only standard API in C++ is the STL, for console and file I/O, memory management, math and some data structures. The .NET Framework API and the Java API cover many more things (see "easy integration").
I think the main reason that game companies stick with C++ is that they have existing code in it. Once you've written your graphics wrapper, I/O wrapper, networking wrapper, window framework wrapper, image loader, memory manager, RTTI system, etc, you can easily use C++ as a high level language. So you reuse your engine in future games, adding extra code to each part as required. If you are starting from scratch, however, as most people on gamedev.net are, you'd be a lot better off choosing a language and framework that already provides this functionality for you, so you can get on with the really interesting things that make your game idea unique.