About private instance variables in Objective-C
In xCode 3, I defined private instance variables in a class. When I directly access the private variables in the client codes, why does the compiler just show me a warning, not an error? The code can still run. The warning says this maybe a hard error in the future. What does the “hard error” […]
How to store molecules in memory?
I want to store molecules in memory. These can be simple molecules: Methane (CH4) C-H bond-length: 108.7 pm H-H angle: 109 degrees But also more complex molecules, like paracetamol (C8H9NO2): How can I store molecules in memory, including all bond-lengths and angles? A good idea to store atom-structs in an array? Or is there a […]
Global variables in Objective-C – difference in extern and top of .m file declaration
I know you can define a global variable in Objective-C by using “extern“, but I just realized that the variables I had declared at the top of my .m file before my first method were also accidentally global (and that was causing some problems). I moved them into the @interface part of my header file, […]
In Objective-C, are int variables that haven't been assigned a value nil?
If I have this in my .h file: int index; And then in the .m file I have: if (index == nil) and I haven’t assigned a value to index, will that come up true? EDIT I guess nil is only used for objects. So what is the state of an int that hasn’t been […]
iPhone SDK Nonatomic and Atomic
Really quick and simple question: In Objective-C what is the difference between nonatomic and atomic? like when declaring properties like “@property (nonatomic, retain) id object”?
Declaring instance variables in iOS – Objective-C
Ok, I’ve read a lot around these days about this topic and I alwyas get confused because the answers is different every search I make. I need to know the best way to declare instance variables in iOS. So far I know I should only declare them inside .m file and leave .h clean. But […]