On 04.04.2009, at 02:30, Eric Hermanson wrote:
Now, one would expect that the array would contain:

        element 1: MyCounterInstance.oid=1
        element 2: MyCounterInstance.oid=2

However, this is NOT the case. Either the compiler or the runtime executes the SECOND call to [MyCounterClass newObject] FIRST, so the array actually contains:

        element 1: MyCounterInstance.oid=2
        element 2: MyCounterInstance.oid=1


Nothing to do with ObjC or NSArray. That's a part of the C standard left open to allow platform-specific optimizations. I've blogged about it in a simpler context here:

        http://zathras.de/blog-c-parameter-evaluation-order.htm

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

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

Reply via email to