Friday, August 30, 2013

Old dog employing old tricks

I downloaded a code from this tutorial: http://maniacdev.com/2010/08/beginners-iphone-action-game-tutorial


But when compiling, this has an error:
// zero out memory. (do not overwrite isa & mPoolPredecessor, thus "+2" and "-8")
memset((id)object + 2, 0, malloc_size(object) - 8);


The error:
Arithmetic on pointer to interface 'id', which is not a constant size for this architecture and platform


Presumably, that works on older version of Xcode or Objective-C. This is how I was able to make it run:
// zero out memory. (do not overwrite isa & mPoolPredecessor, thus "+2" and "-8")
memset((id) (((int *)object) + 2), 0, malloc_size(object) - 8);



Happy Computing! ツ

No comments:

Post a Comment