Re: How are structs passed to Objective-C methods?
Re: How are structs passed to Objective-C methods?
- Subject: Re: How are structs passed to Objective-C methods?
- From: Rick Mann <email@hidden>
- Date: Fri, 02 Nov 2012 21:33:51 -0700
Ah! I finally figured out the difference.
First of all, the structs in the test app are (simple) C++ classes: class Rect : public CGRect {};
But when I added a copy constructor to the Rect class, it turned into pass-by-reference, even for a declared pass-by-value parameter.
Don't understand why, but now I know what triggered the difference.
--
Rick
On Nov 2, 2012, at 21:26 , Rick Mann <email@hidden> wrote:
> In my (OS X) app, as part of debugging another issue, I noticed that the debugger is showing a struct parameter type as a reference, even though it is declared plain. In the little test case app I built to help, the same struct is passed by value.
>
> In both cases, it's a parameter to a property setter on an NSManagedObject subclass. But in one, LLDB shows it as "Rect&" when stopped inside the setter, and in the other, it shows it as "Rect".
>
> In both cases, it seems to work correctly.
>
> --
> Rick
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden