I\'m studying Steven Kochan\'s \"Programming in Objective-C 2.0\". We created a Fraction object with two int instance variables. Later in the book Kochan uses the sizeof sta
The object's size could still change because you're using the modern ABI. In older versions of Objective-C, objects were basically structs and that meant it was possible to sizeof() them. This is no longer the case, and it was never a particularly good idea in the first place. I'm not sure what Kochan was trying to teach with it, but FYI this is not necessary to program Objective-C. You should be able to get the old behavior by building as 32-bit on the Mac, but again, that isn't something you'll want to do in real programs.
To follow up on what Chuck said, you should use class_getInstanceSize()
at runtime if you really need to know the size of an object.