• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
      • From: vincent habchi <email@hidden>
References: 
 >Re: NSTextField fieldeditor subclass example? (and an unrelated other inquiry) (From: Matt Neuburg <email@hidden>)
 >Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry)) (From: vincent habchi <email@hidden>)

  • Prev by Date: Re: Pass-by value… warning
  • Next by Date: Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
  • Previous by thread: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
  • Next by thread: Re: Pass-by value… warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
  • Index(es):
    • Date
    • Thread