On Jul 4, 2009, at 5:39 PM, Ian Havelock wrote:
For future reference, in many cases EXC_BAD_ACCESS can be indicative
of a memory management problem. Here, however, you are asking NSLog
to print int values as objects ('%@' is the format specifier for an
object):
NSLog(@"Number of Sides: %@, Min: %@, Max: %@", [poly1
numberOfSides], [poly1 minimumNumberOfSides], [poly1
maximumNumberOfSides]);
The runtime treats the integer as the address of an object and tries
to send it a message, which doesn't work out so well...
From <http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265
>, the specifier for an int is '%d', hence:
NSLog(@"Number of Sides: %d, Min: %d, Max: %d", [poly1
numberOfSides], [poly1 minimumNumberOfSides], [poly1
maximumNumberOfSides]);
mmalc
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com