News for hackers. Stuff that matters.
Re:nil, Nil, NULL, NSNull by seanalltogether on Monday January 07, 2013 @11:38AM (#5021794)
Also for what its worth, variable declarations are not nil by default, this bug tied me up for quite some time.

  NSString *val;
  if(something){
  	val = @"hello";
  }else if(somthingelse){
  	val = @"goodbye";
  }
  if(val){
  	[self display:val];
  }
this can send you on a wild goose chase for not declaring val = nil initially.
Re:nil, Nil, NULL, NSNull by Scorponok on Monday January 07, 2013 @11:45AM (#5021829)
This is no longer true when using ARC. See the "Stack Variables Are Initialized with nil" section of http://developer.apple.com/library/ios/#releasenotes/Objecti...

"Using ARC, strong, weak, and autoreleasing stack variables are now implicitly initialized with nil."

This doesn't affect plain C variables, but it would solve the issue you had above.

Re:nil, Nil, NULL, NSNull by xsmasher on Monday January 07, 2013 @01:38PM (#5022405)
That's a rule of C; stack vars are not initialized. Same thing would happen with an int.

Member variables of a class are set to zero by (init or alloc? can't remember.)

Re:nil, Nil, NULL, NSNull by micampe on Monday January 07, 2013 @01:02PM (#5022230)
And, if you don’t or can’t use ARC, turn on -Wuninitialized or use the static analyzer (clang warns on uninitialized values only with -Wall).
Re:nil, Nil, NULL, NSNull by mikeash on Monday January 07, 2013 @11:42AM (#5021813)
This is no longer true when using ARC.