Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
- Subject: Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
- From: Graham Cox <email@hidden>
- Date: Wed, 7 Jul 2010 17:33:54 +1000
On 07/07/2010, at 3:59 PM, vincent habchi wrote:
> - (void)drawPoint:(CGContextRef)ctx origin:(CGPoint)origin dimension:(int)dim data:(double **)data {
> double pt [dim];
>
> for (int i = 0 ; i < dim ; i ++, *data ++) {
> memcpy (& (pt [i]), * data, sizeof (double));
> }
I have to ask - why are you doing a copy here, and in such an inefficient way too? Your data already is an array of doubles, why do you need to convert to another one? Also, why the double indirection?
You may find that doing things conventionally will not only keep the compiler from whining, but boost performance too. Win-win!
Curious, Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden