From: Panayotis K. <pan...@pa...> - 2009-10-30 19:11:57
|
On 30 Οκτ 2009, at 8:35 μ.μ., Markus Heberling wrote: > Hi, > > take this code convert it to objc and run it: > > public class Test{ > Object thisIsNotInitialized; > > void test(){ > if(thisIsNotInitialized==null) > System.out.println("null"); > } > > public static void main(String[] args){ > new Test().test(); > } > } > > I would expect to get "null" printed to the console. But that > doesn't happen. The generated if is something like thos: > > if (_op1.o != [NSNull null]) goto label0; > > So it checks for [NSNull null]. But _op1.o contains 0x0 and the > check is false. So I would guess that the initialization code of the > ObjC variables has to be changed so that they contain [NSNull null] > and not 0x0 by default. > > Hope you get what I mean. If a selector returns nil, what is seen in Java? |