PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PPC to PC issues

Hi!
I have tried to test how my game code works on PC, and there are some strange things happening. Why do I get every bool variable as true (it is always false be default on ppc when it is initialized) and other variables like int as -842150451? Is it normal or something is wrong?
Another thing is that codes like if (variable == 1) never works no matter is variable really 1 or true, but it works for if (variable != 1) all the times.
Hi Ryumaster,

You shouldn't rely on variables being initialized to default values, because this is usually not the case. These variables can have any value (it depends on what's currently stored in memory and can be anything), they must be initialized before using them. For example:

Code:

int x = 10;


If you don't initialize variables before using them, the compiler will give you a warning: "value x used without being initialized".