NSString *explanation; [ self doSomeThingAndExplain:( urgent ? NULL : &explanation ) ];
I tried some REALLY ugly casts putting __autoreleasing and __strong here and there around the *s in the explainP but got nowhere, so that's the best I can come up with apart from writing doSomethingAndDontExplain which calls the other one with NULL. On 5 Dec, 2012, at 12:56 PM, "Gerriet M. Denkmann" <[email protected]> wrote: > I have (using Arc) a method which works fine: > NSString *explanation; > [ self doSomeThingAndExplain: &explanation ]; > > Now I decided that sometimes I don't need this explanation. So I changed it > to: > > NSString **explanatioP = urgent ? NULL : &explanation; // <-- "no explicit > ownership... > [ self doSomeThingAndExplain: explanatioP]; // passing address of > non-local object... > > But now the compiler gets really upset (errors written as comments above). > > What Arc-magic is needed to get this to compile? > > Gerriet. > > > > _______________________________________________ > > Cocoa-dev mailing list ([email protected]) > > 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/rols%40rols.org > > This email sent to [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
