Best *FREE* C++ compiler/tutorials?

Q&A, advice, reviews, and news about the computers, phones, TVs, stereos, and pretty much anything else that can't be easily whittled out of a stick or chipped out of stone.
User avatar
Zero_Point
Redshirt
Posts: 1200
Joined: Wed Oct 22, 2003 7:24 pm
Location: Clovis... No, not California! New Mexico!!! Sheesh!

Re: Best *FREE* C++ compiler/tutorials?

Post by Zero_Point » Sat Apr 23, 2005 11:56 am

Well, which one would provide the most "power", so to speak? Or rather, which is the better "gaming language"?

I've thought about BlitzBasic and all others like it, but they're generally too slow from what I've heard, and with all the extra physics I'm hoping to add, it'll kill performance, from what I can tell.
"If the women don't find you handsome, they should at least find you handy" - Red "Duct-tape" Green
Image

User avatar
Felan
Buddhist Snack
Posts: 1316
Joined: Tue Feb 11, 2003 8:07 pm
Real Name: Chris
Gender: Male
Location: Georgia
Contact:

Post by Felan » Sat Apr 23, 2005 1:03 pm

You could always write in assembly...thats pretty high >.>

desertfox
Redshirt
Posts: 69
Joined: Thu Aug 07, 2003 12:41 pm
Location: Pittsburgh, PA

Re: Best *FREE* C++ compiler/tutorials?

Post by desertfox » Sat Apr 23, 2005 5:41 pm

I disagree, I think when you write properly written C++ code, it is a very high level language. I very often find it lets me write better abstractions than languages like Java because of the high amount of expressiveness you get. Granted, yes, it's easier to shoot yourself in the foot in C++ than other languages, but anymore I don't think it's just "C with some stuff tacked on". It is very much its own language, thanks to the standard library and ability to support multiple paradigms (you can do procedural, objcet-oriented, generic, functional, and even aspect-oriented programming all in C++ relatively smoothly).

I'm not sure what "language" improvements Java has to offer over C++. In fact I think Java takes a step backward on the language ("oh, we don't need all these extra language features, let's just throw half of them away"). Garbage collection is the only thing I think Java has to offer. If I really want garbage collection in C++ I'll use C++/CLI (.NET). But, given a choice between garbage collection and deterministic destruction, I'll take the latter any day of the week. The ability to *know* when an objcet is going out of scope and will be destroyed is incredibly useful for a very wide variety of techniques. Look up Resource Acquisition is Initialization (RAII).

I've also yet to find a containers library as well put together as the STL. It's not perfect, no, but it allows powerful decoupling of containers from the algorithms that operate on data stored in those containers via iterators. The STL is basically 3 things: a set of containers (vector,list, map), a set of algorithms (for_each, copy, find, replace, sort,etc.), and generic iterators that bind the two together.

Some stuff to look up to write high-level C++ code:
- smart pointers : http://boost.org/libs/smart_ptr/smart_ptr.htm
- STL : http://www.sgi.com/tech/stl/ (note, SGI's STL documentation isn't 100% correct, but it's the best on the web, MSDN is actually a better reference, but provides no introduction)
- RAII : http://www.hackcraft.net/raii/
- If you use exceptions, ScopeGuard : http://www.cuj.com/documents/s=8000/cuj ... exandr.htm
(although, even if you don't personally use exceptions, the standard library or 3rd party libraries might, thus it's still good to check this out)


End note: Yes, C++ incurs a pretty large learning curve, but the rewards afterward are IMO well worth it. C++ isn't always the most appropriate language (if you're doing a quick dirty GUI program use VB or some .NET language). Or if you're doing a fairly small program where performance isn't a huge issue, use Python (BitTorrent is written in Python, which I fully agree with, cuase BitTorrent is relatively small, and the main bottleneck is the network, not processing speed, obviously).

Just my $2 (this is a lot more than $.02)
Is life so dear, or peace so sweet, as to be purchased at the price of chains and slavery?

pc486
Redshirt
Posts: 532
Joined: Fri Jul 09, 2004 1:48 am

Post by pc486 » Sat Apr 23, 2005 9:43 pm

I wasn't talking about language power (which can descibe a lot of things) but the design of a language. Java is higher level than C++ because of not only the scanner simplicity but the lack of contradictory or wierd conventions. For example, there are three different ways to dynamically allocate memory in C++ and they cannot be interchanged. There are also several points in which C++ can be ambigious (a very bad thing in a language), like when dealing with classes that can inherit other classes and the new class and be constructed down to the inherited class.

As far as language design goes, Java is far superior to C++. A lot of touchy issues and design problems that need to be worked around in C++ are simply gone in Java. Java really isn't a "multiparadigm" (Stroustrup's own words) language and that's why it's simpler, cleaner, and missing some features that C++ has :P.

In language power land C++ is really really powerful. There are tons of C++ libraries and support along with C backward compatibility so all the libraries built up in the last 30 years in C can be used with C++. Java has a huge library as well but C++'s is even bigger.

Also, many interperted languages like Python really don't have a large performance hit compared to C or C++. In fact the functional language OCaml has been shown to be at least as fast if not faster than C in several cases, and that's saying a lot about functional languages which are traditionally very slow. Program speed really is up to the programmer to make the a language work quickly. Choose appropriate algorithms first, then language, and then assembly :-).

IMHO, I agree that garbage collection sucks. The algorithms for it are quite good and can be extreemly fast and deterministic. What makes garbage collection not that great in real life is because the TLB always gets trashed. As almost everyone knows, memory access is far far slower than the processor and if the TLB is giving bad hit rates then memory access climbs considerably. If future memory is cheap and is at least as fast as processor core speeds then garbage collection will become more lucrative.

kyoryu
Redshirt
Posts: 153
Joined: Thu Apr 14, 2005 11:24 pm
Contact:

Re: Best *FREE* C++ compiler/tutorials?

Post by kyoryu » Mon Apr 25, 2005 6:34 pm

First, a bit of a clarification... a 'low-level' language is one that's close to the metal... assembly is about as low as you can go. C/C++ are a step above that.

[quote="desertfox";p="484563"]
I've also yet to find a containers library as well put together as the STL. It's not perfect, no, but it allows powerful decoupling of containers from the algorithms that operate on data stored in those containers via iterators. The STL is basically 3 things: a set of containers (vector,list, map), a set of algorithms (for_each, copy, find, replace, sort,etc.), and generic iterators that bind the two together.
[/quote]

Unfortunately, it also increases link times like a bitch, especially in large projects. I think the implementation of generics in C# and Java is MUCH better. From what I understand, and have seen, the C++ implementation seems to mostly happen in the preprocessor, while the C#/Java implementations actually are more like 'classes with a type parameter'.
Some stuff to look up to write high-level C++ code:
- smart pointers : http://boost.org/libs/smart_ptr/smart_ptr.htm
- STL : http://www.sgi.com/tech/stl/ (note, SGI's STL documentation isn't 100% correct, but it's the best on the web, MSDN is actually a better reference, but provides no introduction)
- RAII : http://www.hackcraft.net/raii/
- If you use exceptions, ScopeGuard : http://www.cuj.com/documents/s=8000/cuj ... exandr.htm
(although, even if you don't personally use exceptions, the standard library or 3rd party libraries might, thus it's still good to check this out)
That's all very nice, but it doesn't change the fact that, in a large codebase, especially with multiple programmers, the amount of time you are going to spend debugging null/trashed pointers, blown stacks, and other nice things you get from writing low-level code is significant. I have yet to hear of a game that went through testing that didn't have those issues. Period. There's a REASON scripting is becoming so dominant in the industry... and that's the fact that it's a lot easier to code gameplay code in script, and it's a lot less likely to cause as weird and nasty of bugs as you can get in C/C++.

Smart pointers, etc., help, but they are NOT a panacea.
End note: Yes, C++ incurs a pretty large learning curve, but the rewards afterward are IMO well worth it. C++ isn't always the most appropriate language (if you're doing a quick dirty GUI program use VB or some .NET language). Or if you're doing a fairly small program where performance isn't a huge issue, use Python (BitTorrent is written in Python, which I fully agree with, cuase BitTorrent is relatively small, and the main bottleneck is the network, not processing speed, obviously).
Agreed 100%. And, for a small game, I'd argue that C/C++ is NOT the best language. Especially as a hobbyist, time is in short supply, and you're better off using your time working on the things that are actually interesting... gameplay code, game design concepts, etc. Unless you're trying to write an engine for the sake of writing an engine, of course.

Look at the Unreal engine... the vast majority of their gameplay code is in script. The vast, VAST majority. It's the 80/20 rule, even in an engine designed for maximum performance, use the horsepower where it's needed, and save the headaches where they can be saved.

desertfox
Redshirt
Posts: 69
Joined: Thu Aug 07, 2003 12:41 pm
Location: Pittsburgh, PA

Re: Best *FREE* C++ compiler/tutorials?

Post by desertfox » Tue Apr 26, 2005 2:27 pm

[quote="kyoryu";p="485414"]First, a bit of a clarification... a 'low-level' language is one that's close to the metal... assembly is about as low as you can go. C/C++ are a step above that.
[/quote]

Well, that's fine. For clarification, a 'high-level' language is one that allows useful abstractions for solving a problem. With C++, you can go as high or as low level as you want.

[quote="kyoryu";p="485414"]Unfortunately, it also increases link times like a bitch, especially in large projects. I think the implementation of generics in C# and Java is MUCH better. From what I understand, and have seen, the C++ implementation seems to mostly happen in the preprocessor, while the C#/Java implementations actually are more like 'classes with a type parameter'.
[/quote]

Other way around. C++ templates (generics) are actually generic. I confess I don't know much about C# generics, but in Java, generics are handled as a preprocessor. Basically, all generics do for you in Java is eliminate some casting and provide auto-boxing of primitives. All of the "generic" information is eliminated before compile-time (type-erasure). Contrast this to C++, where templates fit nicely into the already-existing type system and can be manipulated at compile-time. C++ template usage has evolved well beyond the "container of type T" stage that Java is currently in. Yes, templates increase compile times, but IMO it's a small price to pay for the added flexibility and abstraction.

As far as I'm concerned, genrics in Java are essentially useless other than to make code look neater by eliminating lots of casting. There's little you an do with the actual generic parameters.


And I agree that scripting is very good, I'm a big fan of Python and Lua (Lua is a nifty little language, fully dynamic). But I'd never use Python to develop a full game or larger-than-small size application, not because of the performance hit, but because I personally don't think dynamically typed programming languages are particularly good for large system development. It's way too easy to abuse the type system, and I prefer compile-time errors and checks to runtime errors and checks whenever possible.
Is life so dear, or peace so sweet, as to be purchased at the price of chains and slavery?

kyoryu
Redshirt
Posts: 153
Joined: Thu Apr 14, 2005 11:24 pm
Contact:

Re: Best *FREE* C++ compiler/tutorials?

Post by kyoryu » Tue Apr 26, 2005 4:37 pm

[quote="desertfox";p="485951"]And I agree that scripting is very good, I'm a big fan of Python and Lua (Lua is a nifty little language, fully dynamic). But I'd never use Python to develop a full game or larger-than-small size application, not because of the performance hit, but because I personally don't think dynamically typed programming languages are particularly good for large system development. It's way too easy to abuse the type system, and I prefer compile-time errors and checks to runtime errors and checks whenever possible.[/quote]

Really? The guys that developed EVE Online would disagree with you... the whole game was written in Python, with the parts that were causing performance issues then re-written as C calls from Python.

In general, I agree with you on letting the compiler catch as many errors... I should use the constant==variable format more than I do!

As far as increased compile times.... depends on the size of the project and how heavily STL dependent it is. And it's generally not COMPILE times that get increased heavily, it's LINK times. It's not significant on smaller projects, but as your codebase climbs from the several hundred thousand into the millions level... it can be a substantial increase.

User avatar
Zero_Point
Redshirt
Posts: 1200
Joined: Wed Oct 22, 2003 7:24 pm
Location: Clovis... No, not California! New Mexico!!! Sheesh!

Re: Best *FREE* C++ compiler/tutorials?

Post by Zero_Point » Fri Apr 29, 2005 3:38 am

Okay... So, which would be better for game development? I may have to stick with C++ since the graphics engine I've chosen uses it, though it may be cross-platform, I'll have to check to make sure...
"If the women don't find you handsome, they should at least find you handy" - Red "Duct-tape" Green
Image

kyoryu
Redshirt
Posts: 153
Joined: Thu Apr 14, 2005 11:24 pm
Contact:

Post by kyoryu » Fri Apr 29, 2005 4:18 am

which graphics engine is that?

User avatar
Zero_Point
Redshirt
Posts: 1200
Joined: Wed Oct 22, 2003 7:24 pm
Location: Clovis... No, not California! New Mexico!!! Sheesh!

Re: Best *FREE* C++ compiler/tutorials?

Post by Zero_Point » Fri Apr 29, 2005 4:32 am

OGRE.

I thought about Irrilicht, but this one seems slightly faster.
"If the women don't find you handsome, they should at least find you handy" - Red "Duct-tape" Green
Image

Locked

Who is online

Users browsing this forum: No registered users and 1 guest