ObjC ivar/global var declaration – a clarification

You can declares iVar-s in header files but it’s better in the implementation, so they will be really invisible for others.
You should do this way:

But what if you forget the parenthesis and you put the variable simply beside the @synthesize?
Like this:

The compiler will treat it like other variables outside the class. So they will be global variables. Unfortunately in this case these variables is not just shared among all instances but shared in the whole project. What does it mean? It means if you set the value in one instance to 1, and later you set it to 2 in another instance, the value will be 2 for both (since you only have one instance in fact instead of two). AND since it wasn’t marked as static if you have an other global variable with the same name that will be shared together with the variables in the class, even if you did it accidentally.

WARNING: you won’t get any warning or error. It could be a pain in your ass to find these kind of bugs.

So just to clarify:

Good luck!