That's good. But leave the optimization features off unless you intend to run the program on another computer. The optimizations make debugging harder.
Originally Posted by skyliner
It essentially creates global variables, which are considered Evil™.
Could you be so kind and explain why ? I find rather convenient to do the first.
You could, and in fact, I'd say it's better, but in time you will end up with so many variables to a function it will just make it difficult to read, type and maintain. At this point, you could just pass in a struct or an object.
Right, would it not be better to pass a specific member instead of the whole structure though?? I.E sub.shape vs sub.
In case of collisions, yes, you will get an error.
Wouldn't the compiler warn you or something ?
Seriously, Rectangle. What namespace Rectangle belongs too ? :D
Essentially it means that it is the optimum size for the processor, so that it can process it as fast as possible.
Would you please elaborate ?
Each register in the cpu is a certain size, depending on your cpu architecture. If you try to add two 64-bit numbers on a 32-bit cpu (32-bit registers), it will take longer than if you add two 32-bit numbers (or below).
Nevertheless, this is all implementation defined (read: compiler vendors do whatever they want), so don't read too much into it.
It all depends on your compiler. In case of using the mingw compiler, you typically have to use wchar_t. If you can use C++11, there are specific types dedicated for unicode, but I don't know if mingw supports them.
Very illustrating. I still have doubts on how to use unicode on my program though. Do I have to use a special processor directive, include a specific library ?? I'll have too look it up on the web.
Then you have to remember to call the appropriate functions. For example, wcout instead of cout.
That's enough to get you started, but internationalization is, as they say, a big field, and a complex one.
We don't do it for the size. We do it for the convenience and the message it implies.
If we follow that logic then why bother using bools at all. We should use integers/longs for everything that doesn't need decimals.
If you use a bool, then we know it only takes true of false, not some limited real number range.
Also, in some languages, integers are not implicitly converted to booleans like in C++.
so if (5) would yield true in C++, but wouldn't work in Java.
Why? Because an integer is not a boolean expression.
Performance gain is debatable. It all depends on how well the compiler optimizes the code, so don't worry about it.
I'm curious however, is there any performance gain by doing it that way or is is just for convenience ?
But it certainly beats coding a long switch case.
In this case, they're typically stored in a read-only area inside your executable.
Also, how are the strings typed in the source code, stored and later retrieved during runtime ?
True, but in our defense, remember that in the real world, you will almost always happen upon a big program with thousands on menu items with no idea how to use it. But you will need it for whatever work you are to do.
For me, using code::blocks for the first time was a little different, it required creating a "build target' 'debug' and 'release' configurations and manually creating a source file. Definitely much more work than in devC++. This could be daunting for a newbie. Though not too much.
So I'd consider it as a good exercise. All the school need to do is create a beginner's tutorial to get the students started.