Re: copyWithZone archive/unarchive
On Jan 30, 2015, at 7:26 AM, Trygve Inda cocoa...@xericdesign.com wrote: On Jan 29, 2015, at 9:44 PM, Trygve Inda cocoa...@xericdesign.com wrote: However, naming conventions expect copy to not be autoreleased so should the above really be: return ([copy retain]); Yes, if you're really still not using ARC ;-) —Jens I am not using ARC - this is a large project that has existed for a long time and I see no reason to change it. Just wanted to point out that you can adopt ARC on a per-file basis. Switching back and forth between them can be a bit of a mind bender, but that may be preferable to devoting a chunk of time to a wholesale conversion. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
On Jan 29, 2015, at 9:44 PM, Trygve Inda cocoa...@xericdesign.com wrote: However, naming conventions expect copy to not be autoreleased so should the above really be: return ([copy retain]); Yes, if you're really still not using ARC ;-) —Jens I am not using ARC - this is a large project that has existed for a long time and I see no reason to change it. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
On Jan 30, 2015, at 7:26 AM, Trygve Inda cocoa...@xericdesign.com wrote: On Jan 29, 2015, at 9:44 PM, Trygve Inda cocoa...@xericdesign.com wrote: However, naming conventions expect copy to not be autoreleased so should the above really be: return ([copy retain]); Yes, if you're really still not using ARC ;-) —Jens I am not using ARC - this is a large project that has existed for a long time and I see no reason to change it. Just wanted to point out that you can adopt ARC on a per-file basis. Switching back and forth between them can be a bit of a mind bender, but that may be preferable to devoting a chunk of time to a wholesale conversion. Do you see non-ARC code becoming obsolete? I could probably start moving it to ARC slowly but it is hard to justify time spent on something that is not really needed. I have not run into any serious bugs or unexplained crashes due to messed up retain/release. (touching wood of course). T. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
It’s best to use ARC uniformly in a project and not mix with non-ARC modules. Xcode has a tool to upgrade projects to ARC. I have used it a number of times, and it seems to do a very good job. David On Jan 30, 2015, at 8:15 PM, Jerry Krinock je...@ieee.org wrote: On 2015 Jan 30, at 10:08, Trygve Inda cocoa...@xericdesign.com wrote: Do you see non-ARC code becoming obsolete? Non-ARC code is already obsolete, but what I think you mean is will non-ARC code fail to compile or run in some future OS version. Never say “never” with Apple, but in this case, I don’t think so, because ARC is a layer on top of non-ARC. I could probably start moving it to ARC slowly but it is hard to justify time spent on something that is not really needed. I have not run into any serious bugs or unexplained crashes due to messed up retain/release. Then don’t touch it. Use ARC for new code. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/rowlandd%40sbcglobal.net This email sent to rowla...@sbcglobal.net ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
On Jan 30, 2015, at 8:43 PM, David Rowland rowla...@sbcglobal.net wrote: It’s best to use ARC uniformly in a project and not mix with non-ARC modules. Xcode has a tool to upgrade projects to ARC. I have used it a number of times, and it seems to do a very good job. I haven't had any problem mixing ARC with non-ARC. It's just a little annoying to have to edit the build flags of individual source files. The upgrade tool is nice, but in a big project it can take a fair amount of work to get all the code ready to convert (i.e. fix all the issues raised by the converter) and then track down residual memory issues afterwards. That said, I'd never go back to writing non-ARC code (unless forced to.) —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
Depending on the complexity of the application and amount of core services utilized, converting an existing manual retain/release project to ARC can instigate a battle you may not want to fight. When I attempted that with my medium complexity application, I quickly realized it was a mistake, held up the white flag, and retreated. But understand, my application is mature so there was (and is) no pressing need to convert to ARC. In any case, I wouldn't recommend converting an existing application to ARC solely for the sake of doing so; there should be a compelling reason. That's one man's humble opinion. Paul On 1/30/2015 8:43 PM, David Rowland wrote: It’s best to use ARC uniformly in a project and not mix with non-ARC modules. Xcode has a tool to upgrade projects to ARC. I have used it a number of times, and it seems to do a very good job. David smime.p7s Description: S/MIME Cryptographic Signature ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
On 2015 Jan 30, at 10:08, Trygve Inda cocoa...@xericdesign.com wrote: Do you see non-ARC code becoming obsolete? Non-ARC code is already obsolete, but what I think you mean is will non-ARC code fail to compile or run in some future OS version. Never say “never” with Apple, but in this case, I don’t think so, because ARC is a layer on top of non-ARC. I could probably start moving it to ARC slowly but it is hard to justify time spent on something that is not really needed. I have not run into any serious bugs or unexplained crashes due to messed up retain/release. Then don’t touch it. Use ARC for new code. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
copyWithZone archive/unarchive
I have a custom class (MyCustomClass) and within another class I need to have MyCustomClass be a property whereby I make a copy (vs retaining). MyCustomClass is quite complex and so I was considering using: -(id)copyWithZone:(NSZone *)zone { MyCustomClass* copy = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:self]]; return (copy); } This will of course incur a performance hit for the archiving but in my case it is not very significant. However, naming conventions expect copy to not be autoreleased so should the above really be: return ([copy retain]); ? ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: copyWithZone archive/unarchive
On Jan 29, 2015, at 9:44 PM, Trygve Inda cocoa...@xericdesign.com wrote: However, naming conventions expect copy to not be autoreleased so should the above really be: return ([copy retain]); Yes, if you're really still not using ARC ;-) —Jens ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com